|
@@ -1,8 +1,8 @@
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
import { Message, MessageBox, Notification } from "element-ui";
|
|
import { Message, MessageBox, Notification } from "element-ui";
|
|
-import router from "../router";
|
|
|
|
import Vue from "vue";
|
|
import Vue from "vue";
|
|
import qs from "qs";
|
|
import qs from "qs";
|
|
|
|
+import { logoutHandle } from "./logout";
|
|
|
|
|
|
import GLOBAL from "../config";
|
|
import GLOBAL from "../config";
|
|
import { getAuthorization } from "../plugins/crypto";
|
|
import { getAuthorization } from "../plugins/crypto";
|
|
@@ -10,7 +10,7 @@ import { PLATFORM, DEVICE_ID } from "../constants/app";
|
|
import { initSyncTime, fetchTime } from "../plugins/syncServerTime";
|
|
import { initSyncTime, fetchTime } from "../plugins/syncServerTime";
|
|
import { objTypeOf } from "./utils";
|
|
import { objTypeOf } from "./utils";
|
|
|
|
|
|
-const logoutUrl = "api/admin/common/logout";
|
|
|
|
|
|
+const unNoticeUrls = ["api/admin/common/logout"];
|
|
|
|
|
|
// const IS_DEV = false;
|
|
// const IS_DEV = false;
|
|
// axios interceptors
|
|
// axios interceptors
|
|
@@ -147,9 +147,8 @@ const errorCallback = (error) => {
|
|
const errorDataCallback = (response) => {
|
|
const errorDataCallback = (response) => {
|
|
if (objTypeOf(response.data) === "blob") return response.data;
|
|
if (objTypeOf(response.data) === "blob") return response.data;
|
|
|
|
|
|
- if (response.config.url.includes(logoutUrl)) {
|
|
|
|
- logoutHandle();
|
|
|
|
- return;
|
|
|
|
|
|
+ if (unNoticeUrls.some((url) => response.config.url.includes(url))) {
|
|
|
|
+ return response.data;
|
|
}
|
|
}
|
|
|
|
|
|
const error = response.data;
|
|
const error = response.data;
|
|
@@ -194,25 +193,6 @@ const errorDataCallback = (response) => {
|
|
return error;
|
|
return error;
|
|
};
|
|
};
|
|
|
|
|
|
-function logoutHandle() {
|
|
|
|
- const returnUrl = Vue.ls.get("returnUrl");
|
|
|
|
- if (returnUrl) {
|
|
|
|
- window.location.href = returnUrl;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Vue.ls.clear();
|
|
|
|
- const paramDomainCode = window.sessionStorage.getItem("paramDomainCode");
|
|
|
|
- const routeDomainCode = window.sessionStorage.getItem("routeDomainCode");
|
|
|
|
- if (paramDomainCode) {
|
|
|
|
- router.push({ name: "Login", query: { code: paramDomainCode } });
|
|
|
|
- } else if (routeDomainCode) {
|
|
|
|
- router.push({ name: "Login", params: { code: routeDomainCode } });
|
|
|
|
- } else {
|
|
|
|
- router.push({ name: "Login" });
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* response format
|
|
* response format
|
|
* {
|
|
* {
|