diff --git a/src/ainize.ts b/src/ainize.ts index fed66ad..7af0614 100644 --- a/src/ainize.ts +++ b/src/ainize.ts @@ -34,8 +34,8 @@ export default class Ainize { } async logout() { - await this.handler.disconnect(); this.ain.removeDefaultAccount(); + await this.handler.disconnect(); console.log('logout success!'); } diff --git a/src/handlers/handler.ts b/src/handlers/handler.ts index a28b780..e98a366 100644 --- a/src/handlers/handler.ts +++ b/src/handlers/handler.ts @@ -35,8 +35,10 @@ export default class Handler { } private async disconnectedCb() { - console.log('disconnected. reconnecting...'); - await this.connect(); + if(!AinModule.getInstance().isDefaultAccountExist()) { + console.log('disconnected. reconnecting...'); + await this.connect(); + } } async subscribe(requester:string, recordId:string, appName: string, resolve: any) {