perf: refine code

This commit is contained in:
花裤衩 2019-12-29 14:35:13 +08:00
parent 6169577990
commit f70f0675ba
1 changed files with 4 additions and 4 deletions

View File

@ -68,9 +68,9 @@ const actions = {
logout({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('RESET_STATE', '')
removeToken()
removeToken() // must remove token first
resetRouter()
commit('RESET_STATE')
resolve()
}).catch(error => {
reject(error)
@ -81,8 +81,8 @@ const actions = {
// remove token
resetToken({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()
removeToken() // must remove token first
commit('RESET_STATE')
resolve()
})
}