Skip to content

Commit

Permalink
SMA-80: changing navbar and private route to handle 401
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejFrnka committed Apr 14, 2024
1 parent 889414c commit 5febdad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Navbar() {
setLoggedIn(true)
} catch (error) {
const code = (error as ApiError).status
if (code === 400) {
if (code === 401) {
localStorage.removeItem('token')
setLoggedIn(false)
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/components/PrivateRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const PrivateRoute = () => {
await ExSecuredEndpointService.getUserMainPage()
} catch (error) {
const code = (error as ApiError).status
if (code === 400) {
if (code === 401) {
localStorage.removeItem('token')
setAuthorized(false)
}
Expand Down

0 comments on commit 5febdad

Please sign in to comment.