|
|
@ -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) |
|
|
|
}) |
|
|
|