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