@quansitech/antd-admin 1.1.33 → 1.1.35

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.
Files changed (2) hide show
  1. package/dist/lib/upload.js +17 -22
  2. package/package.json +1 -1
@@ -17,16 +17,11 @@ 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 filename, ext, policyRes, formData, url, key, res, err, _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:
24
- filename = options.file.name;
25
- ext = filename.match(/(\.[^.]+)$/);
26
- if (ext) {
27
- filename = filename.replace(ext[1], ext[1].toLowerCase());
28
- }
29
- _context.next = 5;
24
+ _context.next = 2;
30
25
  return http({
31
26
  url: options.action,
32
27
  method: 'get',
@@ -35,22 +30,22 @@ function _customRequest() {
35
30
  noHandle: true
36
31
  },
37
32
  params: {
38
- title: filename,
33
+ title: options.file.name,
39
34
  hash_id: options.file.hash_id,
40
35
  file_type: ((_options$file = options.file) === null || _options$file === void 0 ? void 0 : _options$file.type) || ''
41
36
  }
42
37
  });
43
- case 5:
38
+ case 2:
44
39
  policyRes = _context.sent;
45
40
  if (!policyRes.data.status) {
46
- _context.next = 9;
41
+ _context.next = 6;
47
42
  break;
48
43
  }
49
44
  options.onSuccess && options.onSuccess(_objectSpread(_objectSpread({}, policyRes.data), {}, {
50
45
  url: policyRes.data.url || policyRes.data.file_url
51
46
  }));
52
47
  return _context.abrupt("return");
53
- case 9:
48
+ case 6:
54
49
  formData = new FormData();
55
50
  url = '';
56
51
  if (policyRes.data.server_url) {
@@ -64,8 +59,8 @@ function _customRequest() {
64
59
  }
65
60
  }
66
61
  formData.append('file', options.file);
67
- _context.prev = 14;
68
- _context.next = 17;
62
+ _context.prev = 11;
63
+ _context.next = 14;
69
64
  return http({
70
65
  url: url,
71
66
  method: 'post',
@@ -80,25 +75,25 @@ function _customRequest() {
80
75
  });
81
76
  }
82
77
  });
83
- case 17:
78
+ case 14:
84
79
  res = _context.sent;
85
80
  err = res.data.info || res.data.err_msg;
86
81
  if (!err) {
87
- _context.next = 23;
82
+ _context.next = 20;
88
83
  break;
89
84
  }
90
85
  message.error(err);
91
86
  options.onError && options.onError(new Error(err), res.data);
92
87
  return _context.abrupt("return");
93
- case 23:
88
+ case 20:
94
89
  options.onSuccess && options.onSuccess(_objectSpread(_objectSpread({}, res.data), {}, {
95
90
  url: res.data.url || res.data.file_url
96
91
  }));
97
- _context.next = 31;
92
+ _context.next = 28;
98
93
  break;
99
- case 26:
100
- _context.prev = 26;
101
- _context.t0 = _context["catch"](14);
94
+ case 23:
95
+ _context.prev = 23;
96
+ _context.t0 = _context["catch"](11);
102
97
  if (_context.t0 instanceof AxiosError) {
103
98
  options.onError && options.onError(_context.t0, (_e$response = _context.t0.response) === null || _e$response === void 0 ? void 0 : _e$response.data);
104
99
  }
@@ -111,11 +106,11 @@ function _customRequest() {
111
106
  });
112
107
  }
113
108
  throw _context.t0;
114
- case 31:
109
+ case 28:
115
110
  case "end":
116
111
  return _context.stop();
117
112
  }
118
- }, _callee, null, [[14, 26]]);
113
+ }, _callee, null, [[11, 23]]);
119
114
  }));
120
115
  return _customRequest.apply(this, arguments);
121
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quansitech/antd-admin",
3
- "version": "1.1.33",
3
+ "version": "1.1.35",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"