|
@@ -1,4 +1,5 @@
|
|
|
import axios, { AxiosResponse } from "axios";
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import qs from "qs";
|
|
|
import { openLoading, closeLoading } from "./loading";
|
|
|
import { openErrorMsg } from "./errorMsg";
|
|
@@ -88,6 +89,15 @@ axios.interceptors.request.use(async (config) => {
|
|
|
|
|
|
const responseInterceptor = (res: AxiosResponse<any, any>) => {
|
|
|
closeLoading();
|
|
|
+ if (res.data.code === 4010){
|
|
|
+ ElMessageBox.alert("您没有访问权限", "提示", {
|
|
|
+ confirmButtonText: "我知道了",
|
|
|
+ type: "warning",
|
|
|
+ showClose: false
|
|
|
+ }).then(async () => {
|
|
|
+ window.open(window.location.origin + "/admin/#/login");
|
|
|
+ });
|
|
|
+ };
|
|
|
if (!successCode.includes(res.data.code)) {
|
|
|
let errMsg = res.data.msg || res.data.message;
|
|
|
openErrorMsg(errMsg);
|