Skip to content

Commit

Permalink
Merge pull request #110 from ymaheshwari1/#109
Browse files Browse the repository at this point in the history
Fixed: code to handle the case when logout promise rejects(#109)
  • Loading branch information
ymaheshwari1 authored May 28, 2024
2 parents d48daa2 + 96a65d7 commit 4bb796e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/store/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ export const useAuthStore = defineStore('authStore', {
// 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 });
await logout();

// wrapping the parsing logic in try catch as in some case the logout api makes redirection, or fails when logout from maarg based apps, thus the logout process halts
try {
await logout();
} catch(err) {
console.error('Error parsing data', err)

Check warning on line 102 in src/store/auth.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / build_and_deploy

Unexpected console statement

Check warning on line 102 in src/store/auth.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

Unexpected console statement

Check warning on line 102 in src/store/auth.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

Unexpected console statement
}
}

// resetting the whole state except oms
Expand Down

0 comments on commit 4bb796e

Please sign in to comment.