mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
handle errors
This commit is contained in:
parent
c3a9ec92ae
commit
73afb91ba9
|
|
@ -76,6 +76,7 @@ import { SUPPORTED_WALLETS } from '~/constant/wallet'
|
|||
import ButtonCTA from '../../common/input/ButtonCTA.vue'
|
||||
import ButtonCTAOutlined from '../../common/input/ButtonCTAOutlined.vue'
|
||||
import { Network, useNetwork } from '~/composables/useNetwork'
|
||||
import { useNotification } from '~/composables/useNotification'
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
|
@ -89,11 +90,20 @@ export default defineComponent({
|
|||
const { close } = useModal()
|
||||
const { activate } = useWeb3()
|
||||
const { activeNetworkId } = useNetwork()
|
||||
const { showError, showAwaiting, closeAll } = useNotification()
|
||||
|
||||
const connect = async (connector) => {
|
||||
await activate(connector, console.log)
|
||||
showAwaiting("Connecting...")
|
||||
|
||||
try {
|
||||
await activate(connector, undefined, true)
|
||||
close()
|
||||
closeAll()
|
||||
} catch (error) {
|
||||
closeAll()
|
||||
showError("", error.message)
|
||||
}
|
||||
|
||||
close()
|
||||
}
|
||||
const isMetamask = computed(() => process.server ? false : window.ethereum && window.ethereum.isMetaMask)
|
||||
|
||||
|
|
@ -104,7 +114,7 @@ export default defineComponent({
|
|||
return null
|
||||
}
|
||||
|
||||
if(wallet.connector === ledger && activeNetworkId.value !== Network.Mainnet) {
|
||||
if (wallet.connector === ledger && activeNetworkId.value !== Network.Mainnet) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user