Commit 4ce66a95 by 姜雷

处理token过期登出

parent a42f6dea
......@@ -56,7 +56,7 @@ service.interceptors.response.use(response => {
});
// -2:其他客户端登录了;Token 过期了;
if (res.code === '-2') {
if (res.code === -2) {
if (logout) return;
logout = true;
MessageBox.confirm(
......
......@@ -53,10 +53,16 @@ const actions = {
// 登出
LogOut({ commit, state }) {
return logout(state.token).then(() => {
commit(SET_TOKEN, '');
removeToken();
});
return logout(state.token)
.then(() => {
commit(SET_TOKEN, '');
removeToken();
})
.catch(err => {
console.log(err);
commit(SET_TOKEN, '');
removeToken();
});
},
// 前端 登出
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment