Improve logout() LocalAuth logic (#2175)

* Improve logout() LocalAuth logic
- Wait for browser to close to prevent Exception on Windows

* Update Client.js

* Update LocalAuth.js

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
Christophe 2023-08-08 03:51:31 +07:00 • committed by GitHub
commit 776c1b152e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -702,7 +702,14 @@ class Client extends EventEmitter {
await this.pupPage.evaluate(() => {
return window.Store.AppState.logout();
});
await this.pupBrowser.close();
let maxDelay = 0;
while (this.pupBrowser.isConnected() && (maxDelay < 10)) { // waits a maximum of 1 second before calling the AuthStrategy
await new Promise(resolve => setTimeout(resolve, 100));
maxDelay++;
}
await this.authStrategy.logout();
}