Skip to content

Commit

Permalink
DAC-290 Testnet/Mainnet value correction
Browse files Browse the repository at this point in the history
  • Loading branch information
amnambiar committed Jan 31, 2023
1 parent b397eab commit 5c5bbce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions react-web/src/app/App.tsx
Expand Up @@ -24,9 +24,8 @@ const PageLayout = () => {
const { network } = useAppSelector((state) => state.auth);

const networkNames:{[x:string]:string} = {
'0': 'Mainnet',
'1': 'Testnet',
'2': 'Preprod'
'0': 'Testnet',
'1': 'Mainnet'
}

const Banner = memo(() => {
Expand All @@ -35,7 +34,7 @@ const PageLayout = () => {
return (<>
{network !== null && network !== 1 ?
<Alert severity="info" style={{marginBottom: '10px'}}>Your connected wallet is not in Mainnet.</Alert> : null}
{network !== null && network?.toString() !== networkEnvVar ?
{network !== null && network === 1 && network?.toString() !== networkEnvVar ?
<Alert severity="warning">Please make sure you are connected to wallet in {networkNames[networkEnvVar]}.</Alert> : null}
</>)
})
Expand Down
4 changes: 3 additions & 1 deletion react-web/src/components/Header/Header.tsx
Expand Up @@ -73,10 +73,12 @@ const Header = () => {
async() => {
setPollForNetwork(false)
wallet.getNetworkId().then((id: number) => {
// Preview/Preprod/Testnet are all 0. Switching among them cannot be distinguished.
// But, switching to-and-fro Mainnet is triggered
if (id !== network) {
forceUserLogout();
} else {
setPollForNetwork(false)
setPollForNetwork(true)
}
})
},
Expand Down

0 comments on commit 5c5bbce

Please sign in to comment.