Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVEREST-688 | logout on HTTP 400 JWT error #1098

Merged
merged 13 commits into from
Feb 20, 2025
Merged
Prev Previous commit
Next Next commit
chore: unify HTTP 400 & 401 logic
  • Loading branch information
fabio-silva committed Feb 13, 2025
commit 286ec65a8c8105a24124cce4be8dc50aa672e4f2
11 changes: 3 additions & 8 deletions ui/apps/everest/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ export const addApiErrorInterceptor = () => {
notificationsDisabled = notificationsDisabled(error);
}

if (error.response.status === 401) {
localStorage.removeItem('everestToken');
sessionStorage.clear();
location.replace('/login');
}

if (
error.response.status === 400 &&
message.includes(MISSING_MALFORMED_JWT_MESSAGE)
error.response.status === 401 ||
(error.response.status === 400 &&
message.includes(MISSING_MALFORMED_JWT_MESSAGE))
) {
location.href = '/logout';
return;
Expand Down
Loading