mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Log out the user if fetchUser was unsuccessful
This commit is contained in:
parent
fba1072964
commit
34d79dfc64
@ -67,7 +67,7 @@ export const actions = {
|
||||
}
|
||||
return getters.isLoggedIn
|
||||
},
|
||||
async fetchCurrentUser({ commit }) {
|
||||
async fetchCurrentUser({ commit, dispatch }) {
|
||||
const client = this.app.apolloProvider.defaultClient
|
||||
const {
|
||||
data: { currentUser }
|
||||
@ -83,6 +83,7 @@ export const actions = {
|
||||
}
|
||||
}`)
|
||||
})
|
||||
if (!currentUser) return dispatch('logout')
|
||||
const { token, ...user } = currentUser
|
||||
commit('SET_USER', user)
|
||||
return user
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user