|
@@ -1,7 +1,8 @@
|
|
"use strict";
|
|
"use strict";
|
|
|
|
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
-// import store from "@/store";
|
|
|
|
|
|
+import store from "@/store";
|
|
|
|
+import router from "@/router";
|
|
import { getCookie } from "@/utils/cookie";
|
|
import { getCookie } from "@/utils/cookie";
|
|
import { AUTH_TOKEN_FRONT, AUTH_TOKEN_END } from "@/common/Constant";
|
|
import { AUTH_TOKEN_FRONT, AUTH_TOKEN_END } from "@/common/Constant";
|
|
import { getAllPromise } from "@/utils/tools";
|
|
import { getAllPromise } from "@/utils/tools";
|
|
@@ -115,6 +116,12 @@ _axios.interceptors.response.use(
|
|
// store.dispatch("user/logout");
|
|
// store.dispatch("user/logout");
|
|
return Promise.reject(error);
|
|
return Promise.reject(error);
|
|
}
|
|
}
|
|
|
|
+ if (status === 412) {
|
|
|
|
+ message.error("您的登录已过期,请重新登录");
|
|
|
|
+ store.commit('user/SET_LOGOUT'); // 存用户信息
|
|
|
|
+ // window.location.reload();
|
|
|
|
+ router.push({ name: 'login' });
|
|
|
|
+ }
|
|
if (status < 200) {
|
|
if (status < 200) {
|
|
message.warning(`未处理的消息响应,状态码:${status}`);
|
|
message.warning(`未处理的消息响应,状态码:${status}`);
|
|
} else if (status >= 300 && status < 400) {
|
|
} else if (status >= 300 && status < 400) {
|