This commit is contained in:
duanxiaohai 2024-09-30 14:04:33 +08:00
parent fa3dfec58e
commit c9f31e43e0
1 changed files with 3 additions and 5 deletions

View File

@ -30,7 +30,6 @@ axios.interceptors.response.use(
if (error.response) {
if (error.response.status == 401) {
ElMessage.error("请重新登录!");
const cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i];
@ -38,19 +37,18 @@ axios.interceptors.response.use(
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
}
router.replace({
path: "/guide",
});
} else if (error.response.status == 403) {
ElMessage.error("Status:403资源不可用");
router.replace({
path: "/403",
path: "/error/403",
});
} else if (error.response.status == 404) {
ElMessage.error("Status:404正在请求不存在的服务器记录");
router.replace({
path: "/404",
path: "/error/404",
});
} else if (error.response.status == 500) {
ElMessage.error({
@ -58,7 +56,7 @@ axios.interceptors.response.use(
message: "Status:500服务器发生错误",
});
router.replace({
path: "/500",
path: "/error/500",
});
} else {
ElMessage.error(`Status:${error.response.status},未知错误!`);