make sure to clear old token when logout

This commit is contained in:
taehoon 2019-06-19 23:11:39 -04:00
parent 03a27c6d48
commit 268e9ce504
3 changed files with 7 additions and 2 deletions

View file

@ -19,7 +19,8 @@ const saveImmedeatelyActions = [
'setHighlight', 'setHighlight',
'setOption', 'setOption',
'setClientData', 'setClientData',
'setToken' 'setToken',
'clearToken'
] ]
const defaultStorage = (() => { const defaultStorage = (() => {

View file

@ -22,6 +22,10 @@ const oauth = {
}, },
setToken (state, token) { setToken (state, token) {
state.userToken = token state.userToken = token
},
clearToken (state) {
state.userToken = false
state.token = false
} }
}, },
getters: { getters: {

View file

@ -399,7 +399,7 @@ const users = {
logout (store) { logout (store) {
store.commit('clearCurrentUser') store.commit('clearCurrentUser')
store.dispatch('disconnectFromChat') store.dispatch('disconnectFromChat')
store.commit('setToken', false) store.commit('clearToken')
store.dispatch('stopFetching', 'friends') store.dispatch('stopFetching', 'friends')
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken())) store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
store.dispatch('stopFetching', 'notifications') store.dispatch('stopFetching', 'notifications')