clear stale network error

This commit is contained in:
Noah Zinsmeister 2019-05-28 16:57:18 -04:00
parent 70e9257c49
commit ad7b647df9
No known key found for this signature in database
GPG Key ID: 83022DD49188C9F2

@ -173,12 +173,16 @@ export default function Web3Status() {
// if calling enable won't pop an approve modal, then try to activate injected...
library.listAccounts().then(accounts => {
if (accounts.length >= 1) {
setConnector('Injected', { suppressAndThrowErrors: true }).catch(error => {
// ...and if the error is that they're on the wrong network, display it, otherwise eat it
if (error.code === Connector.errorCodes.UNSUPPORTED_NETWORK) {
setError(error)
}
})
setConnector('Injected', { suppressAndThrowErrors: true })
.then(() => {
setError()
})
.catch(error => {
// ...and if the error is that they're on the wrong network, display it, otherwise eat it
if (error.code === Connector.errorCodes.UNSUPPORTED_NETWORK) {
setError(error)
}
})
}
})
}