update
This commit is contained in:
@ -104,7 +104,7 @@ service.interceptors.response.use(
|
||||
) {
|
||||
return res.data;
|
||||
}
|
||||
if (code === 401) {
|
||||
if (code === 401 || code === 4011) {
|
||||
if (!isRelogin.show) {
|
||||
isRelogin.show = true;
|
||||
ElMessageBox.confirm(
|
||||
@ -129,6 +129,31 @@ service.interceptors.response.use(
|
||||
});
|
||||
}
|
||||
return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
|
||||
} else if (code === 4012) {
|
||||
if (!isRelogin.show) {
|
||||
isRelogin.show = true;
|
||||
ElMessageBox.confirm(
|
||||
"您以被挤下线",
|
||||
"系统提示",
|
||||
{
|
||||
confirmButtonText: "重新登录",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
isRelogin.show = false;
|
||||
useUserStore()
|
||||
.logOut()
|
||||
.then(() => {
|
||||
location.href = "/index";
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
isRelogin.show = false;
|
||||
});
|
||||
}
|
||||
return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
|
||||
} else if (code === 500) {
|
||||
ElMessage({ message: msg, type: "error" });
|
||||
return Promise.reject(new Error(msg));
|
||||
|
Reference in New Issue
Block a user