Commit 4ce66a95 by 姜雷

处理token过期登出

parent a42f6dea
...@@ -56,7 +56,7 @@ service.interceptors.response.use(response => { ...@@ -56,7 +56,7 @@ service.interceptors.response.use(response => {
}); });
// -2:其他客户端登录了;Token 过期了; // -2:其他客户端登录了;Token 过期了;
if (res.code === '-2') { if (res.code === -2) {
if (logout) return; if (logout) return;
logout = true; logout = true;
MessageBox.confirm( MessageBox.confirm(
......
...@@ -53,10 +53,16 @@ const actions = { ...@@ -53,10 +53,16 @@ const actions = {
// 登出 // 登出
LogOut({ commit, state }) { LogOut({ commit, state }) {
return logout(state.token).then(() => { return logout(state.token)
commit(SET_TOKEN, ''); .then(() => {
removeToken(); 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