cfel-base-components 2.5.8 → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.vscode/settings.json
CHANGED
package/package.json
CHANGED
package/src/apiRequest/config.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import axios, { AxiosRequestHeaders } from
|
|
2
|
-
import { notification } from
|
|
1
|
+
import axios, { AxiosRequestHeaders } from "axios";
|
|
2
|
+
import { notification } from "antd";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
let UMI_APP_BASEURL: any = window.location.origin || process.env
|
|
4
|
+
let UMI_APP_BASEURL: any = window.location.origin || process.env;
|
|
6
5
|
const instance = axios.create({ baseURL: UMI_APP_BASEURL });
|
|
7
6
|
|
|
8
7
|
instance.interceptors.request.use(
|
|
@@ -14,7 +13,7 @@ instance.interceptors.request.use(
|
|
|
14
13
|
config.params = {
|
|
15
14
|
...config.params,
|
|
16
15
|
productCode: (window as any)?.g_config?.productCode,
|
|
17
|
-
}
|
|
16
|
+
};
|
|
18
17
|
|
|
19
18
|
return config;
|
|
20
19
|
},
|
|
@@ -29,7 +28,7 @@ instance.interceptors.response.use(
|
|
|
29
28
|
|
|
30
29
|
if (!success) {
|
|
31
30
|
notification.error({
|
|
32
|
-
message: errorMsg
|
|
31
|
+
message: errorMsg,
|
|
33
32
|
});
|
|
34
33
|
return Promise.reject(data);
|
|
35
34
|
}
|
|
@@ -41,30 +40,36 @@ instance.interceptors.response.use(
|
|
|
41
40
|
const { response = {} } = error;
|
|
42
41
|
const { status } = response;
|
|
43
42
|
|
|
43
|
+
if (error.code === "ERR_CANCELED") {
|
|
44
|
+
return Promise.reject(error);
|
|
45
|
+
}
|
|
46
|
+
|
|
44
47
|
enum CodeMessage {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
"发出的请求有错误,服务器没有进行新建或修改数据的操作。" = 400,
|
|
49
|
+
"用户未登录。" = 401,
|
|
50
|
+
"用户得到授权,但是访问是被禁止的。" = 403,
|
|
51
|
+
"发出的请求针对的是不存在的记录,服务器没有进行操作。" = 404,
|
|
52
|
+
"请求的格式不可得。" = 406,
|
|
53
|
+
"请求的资源被永久删除,且不会再得到的。" = 410,
|
|
54
|
+
"当创建一个对象时,发生一个验证错误。" = 422,
|
|
55
|
+
"服务器发生错误,请检查服务器。" = 500,
|
|
56
|
+
"网关错误。" = 502,
|
|
57
|
+
"服务不可用,服务器暂时过载或维护。" = 503,
|
|
58
|
+
"网关超时。" = 504,
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
notification.error({
|
|
59
|
-
message:
|
|
62
|
+
message:
|
|
63
|
+
response?.data?.message ||
|
|
64
|
+
CodeMessage[status] ||
|
|
65
|
+
"服务暂不可用,请检查网络",
|
|
60
66
|
});
|
|
61
67
|
|
|
62
68
|
if (status === 401) {
|
|
63
|
-
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
return Promise.reject(error);
|
|
67
72
|
}
|
|
68
73
|
);
|
|
69
74
|
|
|
70
|
-
export default instance;
|
|
75
|
+
export default instance;
|
package/src/.umi/core/helmet.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// This file is generated by Umi automatically
|
|
3
|
-
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
|
|
6
|
-
import { context } from './helmetContext';
|
|
7
|
-
|
|
8
|
-
export const innerProvider = (container) => {
|
|
9
|
-
return React.createElement(HelmetProvider, { context }, container);
|
|
10
|
-
}
|