改进
This commit is contained in:
parent
8f52997045
commit
d9543bfaf5
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user