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