Browse Source

feat: 修改登出逻辑

sy-water-data-board-ui
hxh 7 months ago
parent
commit
2faef49418
  1. 12
      src/store/modules/user.js

12
src/store/modules/user.js

@ -91,12 +91,22 @@ const user = {
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
logout(state.token).then((res) => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
resolve()
if (res.code === 200) {
var type = res.data.type
if(type === 'redirect'){
window.location.href = res.data.url
}
} else {
Message.error(res.msg)
}
next(`/login?redirect=${to.fullPath}`)
}).catch(error => {
reject(error)
})

Loading…
Cancel
Save