chanage sth

This commit is contained in:
cebgcontract 2022-12-21 17:55:30 +08:00
parent 29dcd58ae2
commit 69ed43b36e
2 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import {
IChainData,
} from "../configs/config_chain";
import {
ACCOUNT_CHANGE,
EventBus,
NEED_CHANGE_CHAIN,
NEED_LOGIN,
@ -330,6 +331,12 @@ export class Blockchain {
if (UserModule.accountId !== accounts[0]) {
this.clearCachedProvider();
await UserModule.LogOut();
EventBus.$emit(ACCOUNT_CHANGE, accounts[0]);
let event = new Event("account_change", {
bubbles: true,
cancelable: false,
});
window.dispatchEvent(event);
setTimeout(() => {
location.reload();
}, 1000);

View File

@ -36,3 +36,5 @@ export class JCChain {
}
export * from "./utils/event-bus";
export * from "./utils/chain.util";
export * from "./utils/browser";