From 92669035be4fa778821883fed7d4c1ca3cb60e09 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 7 Mar 2024 16:38:14 +0530 Subject: [PATCH] Fixed: logout loader on login by only displaying the loader when user is authorized(#337) --- src/store/modules/user/actions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 5320472e..dbaf1917 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -108,11 +108,11 @@ const actions: ActionTree = { // store the url on which we need to redirect the user after logout api completes in case of SSO enabled let redirectionUrl = '' - emitter.emit('presentLoader', { message: 'Logging out', backdropDismiss: false }) - // Calling the logout api to flag the user as logged out, only when user is authorised // if the user is already unauthorised then not calling the logout api as it returns 401 again that results in a loop, thus there is no need to call logout api if the user is unauthorised if(!payload?.isUserUnauthorised) { + emitter.emit('presentLoader', { message: 'Logging out', backdropDismiss: false }) + let resp; // wrapping the parsing logic in try catch as in some case the logout api makes redirection, and then we are unable to parse the resp and thus the logout process halts