Remove token from local storage on auth failures

This commit is contained in:
silverpill 2022-01-03 16:38:26 +00:00
parent 1ffaf9a08c
commit db234bd01b

View file

@ -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
}