on master help sign in
login: throw when no approved MM accounts
commit22d6170adeac3c4382454dd35eccd5ef833e4207 authortomholford <tomholford@users.noreply.github.com> dateWed 23 Feb 2022, 12:56 (5 years ago) parentdcbd38b
1 file changed+5−1
src/views/Login/LoginSelector.tsx+5−1
src/views/Login/LoginSelector.tsx+5−1
@@ -86,11 +86,15 @@ export default function LoginSelector({
8686 }
8787 setMetamask(true);
8888 setMetamaskSelected(true);
89+
8990 const accounts = await window.ethereum.request({
9091 method: 'eth_requestAccounts',
9192 });
92− const wallet = new MetamaskWallet(accounts[0]);
93+ if (accounts.length === 0) {
94+ throw new Error('No accounts approved');
95+ }
9396
97+ const wallet = new MetamaskWallet(accounts[0]);
9498 const web3 = new Web3(window.ethereum);
9599 const authToken = await getAuthToken({
96100 address: wallet.address,