|
@@ -7,8 +7,9 @@ import { notifyInvalidTokenThrottled } from "./axiosNotice";
|
|
|
import { getToken, removeToken, getSessionId } from "../auth/auth";
|
|
|
import axiosRetry from "axios-retry";
|
|
|
import { PLATFORM, DEVICE_ID } from "@/constant/constants";
|
|
|
-import { Notification } from "element-ui";
|
|
|
+import { Notification, MessageBox } from "element-ui";
|
|
|
import CryptoJS from "crypto-js";
|
|
|
+import router from "@/router";
|
|
|
|
|
|
// console.log(btoa(CryptoJS.SHA1("pWWQ0qyaXL8QHni4ig9YiWYTKr8UVQd4")));
|
|
|
// console.log(
|
|
@@ -78,7 +79,7 @@ _axiosApp.interceptors.request.use(
|
|
|
return Promise.reject(error);
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
+let unauthMsgBoxIsShow = false;
|
|
|
// Add a response interceptor
|
|
|
_axiosApp.interceptors.response.use(
|
|
|
(response) => {
|
|
@@ -127,6 +128,24 @@ _axiosApp.interceptors.response.use(
|
|
|
|
|
|
if (status != 200) {
|
|
|
const data = error.response.data;
|
|
|
+
|
|
|
+ if (status === 500 && data && data.code === 500012) {
|
|
|
+ if (unauthMsgBoxIsShow) return error;
|
|
|
+ unauthMsgBoxIsShow = true;
|
|
|
+ MessageBox.confirm("身份验证失效,请重新登录!", "错误提示", {
|
|
|
+ type: "warning",
|
|
|
+ closeOnClickModal: false,
|
|
|
+ closeOnPressEscape: false,
|
|
|
+ showClose: false,
|
|
|
+ callback: (action) => {
|
|
|
+ unauthMsgBoxIsShow = false;
|
|
|
+ if (action !== "confirm") return;
|
|
|
+ router.push({ name: "Login" });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return Promise.reject(error);
|
|
|
+ }
|
|
|
+
|
|
|
if (data && data.message) {
|
|
|
if (showErrorMessage) {
|
|
|
Notification({
|