Handling client.logout() Exception gracefully with optional chaining (#2447)
* Added Optional Chaining to Avoid Breaking The Code * Added Optional Chaining to Avoid Breaking Code * Updated code to handle all node version --------- Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com> Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
parent
066d8fa75e
commit
22af9df3d0
1 changed files with 4 additions and 2 deletions
|
|
@ -802,7 +802,9 @@ class Client extends EventEmitter {
|
|||
*/
|
||||
async logout() {
|
||||
await this.pupPage.evaluate(() => {
|
||||
return window.Store.AppState.logout();
|
||||
if (window.Store && window.Store.AppState && typeof window.Store.AppState.logout === 'function') {
|
||||
return window.Store.AppState.logout();
|
||||
}
|
||||
});
|
||||
await this.pupBrowser.close();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue