committed package-lock.json + logout changes

This commit is contained in:
Adhiraj
2020-08-24 23:23:23 +05:30
parent b4298b772e
commit e2372bf60b
4 changed files with 2656 additions and 15 deletions

View File

@@ -272,10 +272,11 @@ export class WAConnection extends EventEmitter {
* @see close() if you just want to close the connection
*/
async logout () {
if (this.state !== 'open') throw new Error("You're not even connected, you can't log out")
await new Promise(resolve => this.conn.send('goodbye,["admin","Conn","disconnect"]', null, resolve))
this.authInfo = null
if (this.state === 'open') {
//throw new Error("You're not even connected, you can't log out")
await new Promise(resolve => this.conn.send('goodbye,["admin","Conn","disconnect"]', null, resolve))
}
this.close()
}
/** Close the connection to WhatsApp Web */