This commit is contained in:
xiaojunnuo
2024-10-03 01:29:12 +08:00
parent aeed24e87d
commit c9d18f6d8a
17 changed files with 100 additions and 34 deletions
+5 -1
View File
@@ -1,7 +1,7 @@
import axios from "axios";
import { get } from "lodash-es";
import Adapter from "axios-mock-adapter";
import { errorLog, errorCreate } from "./tools";
import { errorLog, errorCreate, response } from "./tools";
import { env } from "/src/utils/util.env";
import { useUserStore } from "../store/modules/user";
/**
@@ -96,6 +96,10 @@ function createService() {
const userStore = useUserStore();
userStore.logout();
}
if (error?.config?.onError) {
error.config.onError(error);
}
return Promise.reject(error);
}
);
@@ -55,6 +55,9 @@ export function errorLog(error: any) {
if (error.response?.data?.message) {
message = error.response.data.message;
}
if (message.indexOf("ssl3_get_record:wrong version number" > -1)) {
message = "http协议错误,服务端要求http协议,请检查是否使用了https请求";
}
// 显示提示
uiContext.get().notification.error({ message });
}