perf: refine code
This commit is contained in:
parent
6169577990
commit
f70f0675ba
|
@ -68,9 +68,9 @@ const actions = {
|
||||||
logout({ commit, state }) {
|
logout({ commit, state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logout(state.token).then(() => {
|
logout(state.token).then(() => {
|
||||||
commit('RESET_STATE', '')
|
removeToken() // must remove token first
|
||||||
removeToken()
|
|
||||||
resetRouter()
|
resetRouter()
|
||||||
|
commit('RESET_STATE')
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
reject(error)
|
||||||
|
@ -81,8 +81,8 @@ const actions = {
|
||||||
// remove token
|
// remove token
|
||||||
resetToken({ commit }) {
|
resetToken({ commit }) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('SET_TOKEN', '')
|
removeToken() // must remove token first
|
||||||
removeToken()
|
commit('RESET_STATE')
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue