fix[logout]: empty tagsview when logout (#2632)

This commit is contained in:
花裤衩 2019-10-08 20:38:19 +08:00 committed by GitHub
parent f266713daf
commit b4cdf528ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -73,13 +73,18 @@ const actions = {
}, },
// user logout // user logout
logout({ commit, state }) { logout({ commit, state, dispatch }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
commit('SET_ROLES', []) commit('SET_ROLES', [])
removeToken() removeToken()
resetRouter() resetRouter()
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, { root: true })
resolve() resolve()
}).catch(error => { }).catch(error => {
reject(error) reject(error)