Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
fix: handle close modal during switch wallet, center button
Browse files Browse the repository at this point in the history
  • Loading branch information
paouvrard committed Apr 13, 2021
1 parent 1995491 commit 2c49c8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/html/incorrect-network-modal.html
Expand Up @@ -3,7 +3,7 @@
class="modal"
style="display: none"
>
<div class="modal__container">
<div class="modal__container" style="text-align: center;">
<div class="modal-image__container">
<!-- Modal Image Will Go Here -->
</div>
Expand Down
10 changes: 8 additions & 2 deletions src/js/authEthereum.js
Expand Up @@ -8,6 +8,7 @@ import {
import render from './render'
import { onClick } from './domHelpers'
import { chainIdToEthNetwork } from './utils'
import * as urlParams from './urlParams'

// SWAP IN YOUR OWN INFURA_ID FROM https://infura.io/dashboard/ethereum
const INFURA_ID = '9c91979e95cb4ef8a61eb029b4217a1a'
Expand Down Expand Up @@ -71,10 +72,15 @@ async function login () {
onClick('authEthereum', login)
onClick('switchEthWallet', async () => {
window.ethInitialized = false
window.dom.hide('unsupportedNetworkModal')
await window.web3Modal.clearCachedProvider()
localStorage.removeItem('walletconnect')
login()
window.dom.hide('unsupportedNetworkModal')
try {
await login()
} catch (error) {
// user closed modal without selecting wallet
window.location.reload()
}
})

// on page load, check if user has already signed in via MetaMask
Expand Down

0 comments on commit 2c49c8c

Please sign in to comment.