Skip to content

Commit

Permalink
Updated check for unauthorized/expired session
Browse files Browse the repository at this point in the history
  • Loading branch information
fmata97 committed Feb 13, 2024
1 parent 7c11d2e commit acaff2e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ function App() {

// logout user when unauthorized
if (error.response.status === 403 || error.response.status === 401) {
if (window.location.pathname.match(/\/home\//g))
showErrorMsg("Session expired or no longer authorized");

setUser(false);
setUser(oldUser => {
if (oldUser) {
showErrorMsg("Session expired or no longer authorized");
}
return false;
});
error.handledByMiddleware = true;
}

Expand Down

0 comments on commit acaff2e

Please sign in to comment.