Remove token from local storage on auth failures
This commit is contained in:
parent
1ffaf9a08c
commit
db234bd01b
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@ export function useCurrentUser() {
|
|||
if (token) {
|
||||
authToken.value = token
|
||||
currentUser.value = await getCurrentUser(token)
|
||||
if (currentUser.value === null) {
|
||||
// Failed to get current user, removing invalid token
|
||||
setAuthToken(null)
|
||||
}
|
||||
}
|
||||
isAuthChecked.value = true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue