|
@@ -12,6 +12,10 @@ import { useMainStore } from "@/store";
|
|
|
|
|
|
let store = null as unknown as ReturnType<typeof useMainStore>;
|
|
|
|
|
|
+setTimeout(() => {
|
|
|
+ store = useMainStore();
|
|
|
+}, 0);
|
|
|
+
|
|
|
const config = {
|
|
|
// baseURL: process.env.baseURL || process.env.apiUrl || ""
|
|
|
timeout: 1 * 60 * 1000, // Timeout
|
|
@@ -37,9 +41,6 @@ function gToken(
|
|
|
|
|
|
_axiosApp.interceptors.request.use(
|
|
|
function (config) {
|
|
|
- if (!store) {
|
|
|
- store = useMainStore();
|
|
|
- }
|
|
|
if (config.setGlobalMask) {
|
|
|
store.globalMask = true;
|
|
|
}
|
|
@@ -98,8 +99,10 @@ _axiosApp.interceptors.response.use(
|
|
|
|
|
|
// 登录失效 跳转登录页面
|
|
|
if (status == 403 || status == 401) {
|
|
|
- notifyInvalidTokenThrottled();
|
|
|
- removeToken();
|
|
|
+ if (error.config.url !== "/api/ess/auth/logout") {
|
|
|
+ notifyInvalidTokenThrottled();
|
|
|
+ removeToken();
|
|
|
+ }
|
|
|
return Promise.reject(error);
|
|
|
} else if (status == 405) {
|
|
|
if (showErrorMessage) {
|