@zgfe/business-lib 1.1.10 → 1.1.11
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/es/utils/ajax.js +3 -3
- package/es/utils/type.d.ts +1 -0
- package/package.json +2 -2
package/es/utils/ajax.js
CHANGED
|
@@ -49,7 +49,7 @@ var errorHandler = function errorHandler(error) {
|
|
|
49
49
|
return response;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
function responseErrorHandler(url, apiResult, errorTitle) {
|
|
52
|
+
function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
53
53
|
if (/\.jsp/.test(url)) {
|
|
54
54
|
return apiResult;
|
|
55
55
|
}
|
|
@@ -59,7 +59,7 @@ function responseErrorHandler(url, apiResult, errorTitle) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if (!apiResult.code) {
|
|
62
|
-
notification
|
|
62
|
+
notification[notifyType || 'error']({
|
|
63
63
|
message: "\u63A5\u53E3\u54CD\u5E94\u7ED3\u6784\u5F02\u5E38"
|
|
64
64
|
});
|
|
65
65
|
throw new Error('接口响应结构异常,缺少code');
|
|
@@ -140,7 +140,7 @@ function _request() {
|
|
|
140
140
|
|
|
141
141
|
case 13:
|
|
142
142
|
res = _context.sent;
|
|
143
|
-
return _context.abrupt("return", responseWrapper ? responseWrapper(url, responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle)) : responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle));
|
|
143
|
+
return _context.abrupt("return", responseWrapper ? responseWrapper(url, responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType)) : responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType));
|
|
144
144
|
|
|
145
145
|
case 17:
|
|
146
146
|
_context.prev = 17;
|
package/es/utils/type.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export declare class ApiResult<T> implements InterfaceApiResult<T> {
|
|
|
84
84
|
}
|
|
85
85
|
export declare type ajaxConfig<T> = RequestOptionsInit & {
|
|
86
86
|
errorTitle?: string;
|
|
87
|
+
notifyType?: 'warning' | 'error' | 'info';
|
|
87
88
|
optionsWrapper?: (url: string, options?: RequestOptionsInit) => {
|
|
88
89
|
url: string;
|
|
89
90
|
options?: RequestOptionsInit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "cd765a91987b55cbcbb8694e72dcf0cf10fbfeb3"
|
|
64
64
|
}
|