@quansitech/antd-admin 1.1.24 → 1.1.25
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/dist/lib/upload.js +12 -11
- package/package.json +1 -1
package/dist/lib/upload.js
CHANGED
|
@@ -17,7 +17,7 @@ export function customRequest(_x) {
|
|
|
17
17
|
function _customRequest() {
|
|
18
18
|
_customRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
19
19
|
var _options$file;
|
|
20
|
-
var policyRes, formData, url, key, res, _e$response;
|
|
20
|
+
var policyRes, formData, url, key, res, err, _e$response;
|
|
21
21
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
@@ -77,21 +77,22 @@ function _customRequest() {
|
|
|
77
77
|
});
|
|
78
78
|
case 14:
|
|
79
79
|
res = _context.sent;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
err = res.data.info || res.data.err_msg;
|
|
81
|
+
if (!err) {
|
|
82
|
+
_context.next = 20;
|
|
82
83
|
break;
|
|
83
84
|
}
|
|
84
|
-
message.error(
|
|
85
|
-
options.onError && options.onError(new Error(
|
|
85
|
+
message.error(err);
|
|
86
|
+
options.onError && options.onError(new Error(err), res.data);
|
|
86
87
|
return _context.abrupt("return");
|
|
87
|
-
case
|
|
88
|
+
case 20:
|
|
88
89
|
options.onSuccess && options.onSuccess(_objectSpread(_objectSpread({}, res.data), {}, {
|
|
89
90
|
url: res.data.url || res.data.file_url
|
|
90
91
|
}));
|
|
91
|
-
_context.next =
|
|
92
|
+
_context.next = 28;
|
|
92
93
|
break;
|
|
93
|
-
case
|
|
94
|
-
_context.prev =
|
|
94
|
+
case 23:
|
|
95
|
+
_context.prev = 23;
|
|
95
96
|
_context.t0 = _context["catch"](11);
|
|
96
97
|
if (_context.t0 instanceof AxiosError) {
|
|
97
98
|
options.onError && options.onError(_context.t0, (_e$response = _context.t0.response) === null || _e$response === void 0 ? void 0 : _e$response.data);
|
|
@@ -105,11 +106,11 @@ function _customRequest() {
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
throw _context.t0;
|
|
108
|
-
case
|
|
109
|
+
case 28:
|
|
109
110
|
case "end":
|
|
110
111
|
return _context.stop();
|
|
111
112
|
}
|
|
112
|
-
}, _callee, null, [[11,
|
|
113
|
+
}, _callee, null, [[11, 23]]);
|
|
113
114
|
}));
|
|
114
115
|
return _customRequest.apply(this, arguments);
|
|
115
116
|
}
|