diff --git a/src/chain/blockchain.ts b/src/chain/blockchain.ts index d95e4e7..f5d8b13 100644 --- a/src/chain/blockchain.ts +++ b/src/chain/blockchain.ts @@ -275,13 +275,13 @@ export class Blockchain { public async disconnect() { try { await UserModule.LogOut() - await this.provider?.disconnect() this.currentChain = 0 this.walletType = 0 this.coinInstanceMap.clear() this.clearCachedProvider() AppModule.updateStep(0) AppModule.updateNonce('') + await this.provider?.disconnect() } catch (err) { } this.clearCachedProvider() diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b8e0896..15f21dc 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -40,7 +40,7 @@ class User extends VuexModule implements IUserState { public sex = '0' public account = '' - @Action + @Action({ rawError: true }) public async Login({ bcInstance, account, chainId, nonce }: {bcInstance: any, account: string, chainId: string | number, nonce: string}) { nonce += '' const tips = 'This signature is only used for verify your account' diff --git a/src/utils/request.ts b/src/utils/request.ts index e9f10e7..2ecfd39 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -33,33 +33,15 @@ service.interceptors.response.use( (response) => { // Some example codes here: // code == 0: success - // code == 50001: invalid access token - // code == 50002: already login in other place - // code == 50003: access token expired - // code == 50004: invalid user (user not exist) // code == 10: username or password is incorrect // You can change this part for your own usage. const res = response.data if (res.errcode) { - Message({ - message: res.errmsg || 'Error', - type: 'error', - duration: 5 * 1000 - }) - if (res.errcode === 50008 || res.errcode === 50012 || res.errcode === 50014) { - MessageBox.confirm( - 'You have been logged out, try to login again.', - 'Log out', - { - confirmButtonText: 'Relogin', - cancelButtonText: 'Cancel', - type: 'warning' - } - ).then(() => { - UserModule.ResetToken() - location.reload() // To prevent bugs from vue-router - }) - } + // Message({ + // message: res.errmsg || 'Error', + // type: 'error', + // duration: 5 * 1000 + // }) return Promise.reject(new Error(res.errmsg || 'Error')) } else { return response.data