This commit is contained in:
iVampireSP.com 2023-03-15 21:42:57 +08:00
parent 8f52997045
commit d9543bfaf5
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -16,7 +16,7 @@ let instance = axios.create({
instance.interceptors.request.use(
(config) => {
if (config.headers === undefined) {
config.headers = {};
// config.headers = {};
}
config.headers["Accept"] = "application/json";
@ -54,16 +54,9 @@ instance.interceptors.response.use(
if (error.response.status === 429) {
alert("请求次数过多");
} else if (error.response.status === 401) {
if (router.currentRoute.value.name !== "login") {
if (!temp.isAlertedToken) {
// alert('您的 访问密钥 可能已经失效,请尝试通过侧边栏来重新登录。');
setTimeout(() => {
router.push({ name: "login" });
}, 1000);
}
}
// if (router.currentRoute.value.name !== "login") {
//
// }
} else if (error.response.status === 404) {
router.push({ name: "index" });
} else {