Skip to content

Commit

Permalink
Merge pull request #290 from ymaheshwari1/fulfillment/fix-logout
Browse files Browse the repository at this point in the history
Fixed: issue of user unable to logout from the app
  • Loading branch information
ravilodhi authored Oct 6, 2023
2 parents 3ba87bf + fd673f9 commit 30d6496
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ const actions: ActionTree<UserState, RootState> = {
if(!payload?.isUserUnauthorised) {
let resp = await logout();

// Added logic to remove the `//` from the resp as in case of get request we are having the extra characters and in case of post we are having 403
resp = JSON.parse(resp.startsWith('//') ? resp.replace('//', '') : 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
try {
// Added logic to remove the `//` from the resp as in case of get request we are having the extra characters and in case of post we are having 403
resp = JSON.parse(resp.startsWith('//') ? resp.replace('//', '') : resp)
} catch(err) {
logger.error('Error parsing data', err)
}

if(resp.logoutAuthType == 'SAML2SSO') {
redirectionUrl = resp.logoutUrl
Expand Down

0 comments on commit 30d6496

Please sign in to comment.