Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Oct 23, 2024
1 parent c82148e commit afee05b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export const InjectedWallet = ({
)
}

const accountInWallet = injectedWallet.accounts.some(
(acc) => acc.toLowerCase() === pilotAddress
)

// Wallet disconnected
if (injectedWallet.accounts.length === 0) {
return (
Expand All @@ -56,7 +52,7 @@ export const InjectedWallet = ({
}

// Injected wallet: right account, wrong chain
if (accountInWallet && injectedWallet.chainId !== chainId) {
if (injectedWallet.chainId !== chainId) {
return (
<SwitchChain
chainId={chainId}
Expand All @@ -69,6 +65,10 @@ export const InjectedWallet = ({
)
}

const accountInWallet = injectedWallet.accounts.some(
(acc) => acc.toLowerCase() === pilotAddress
)

// Wrong account
if (!accountInWallet) {
return (
Expand Down

0 comments on commit afee05b

Please sign in to comment.