@noah-libjs/request 0.0.69 → 0.0.70
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/helper.d.ts +1 -0
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/dist/helper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ICommonOption } from "@noah-libjs/utils";
|
|
|
2
2
|
import { FormInstance } from "antd";
|
|
3
3
|
export type T_FETCH_OPTIONS = ((f?: FormInstance) => (Promise<ICommonOption[]> | ICommonOption[])) | {
|
|
4
4
|
url: string | (() => string);
|
|
5
|
+
dataPath?: string;
|
|
5
6
|
labelKey?: string;
|
|
6
7
|
valueKey?: string;
|
|
7
8
|
method?: 'get' | 'post';
|
package/dist/index.js
CHANGED
|
@@ -333,7 +333,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
333
333
|
};
|
|
334
334
|
function safe_fetch_options(cb, f) {
|
|
335
335
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
336
|
-
var arr, _cb$method, method, _cb$valueKey, valueKey, _cb$labelKey, labelKey, url, _url;
|
|
336
|
+
var arr, _cb$method, method, _cb$valueKey, valueKey, _cb$labelKey, labelKey, dataPath, url, _url;
|
|
337
337
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
338
338
|
while (1) switch (_context.prev = _context.next) {
|
|
339
339
|
case 0:
|
|
@@ -347,7 +347,7 @@ function safe_fetch_options(cb, f) {
|
|
|
347
347
|
arr = _context.sent;
|
|
348
348
|
return _context.abrupt("return", expect_array(arr));
|
|
349
349
|
case 7:
|
|
350
|
-
_cb$method = cb.method, method = _cb$method === void 0 ? 'get' : _cb$method, _cb$valueKey = cb.valueKey, valueKey = _cb$valueKey === void 0 ? 'value' : _cb$valueKey, _cb$labelKey = cb.labelKey, labelKey = _cb$labelKey === void 0 ? 'label' : _cb$labelKey, url = cb.url;
|
|
350
|
+
_cb$method = cb.method, method = _cb$method === void 0 ? 'get' : _cb$method, _cb$valueKey = cb.valueKey, valueKey = _cb$valueKey === void 0 ? 'value' : _cb$valueKey, _cb$labelKey = cb.labelKey, labelKey = _cb$labelKey === void 0 ? 'label' : _cb$labelKey, dataPath = cb.dataPath, url = cb.url;
|
|
351
351
|
_url = isString(url) ? url : url();
|
|
352
352
|
return _context.abrupt("return", cache_fetch(_url, function () {
|
|
353
353
|
return request.ins({
|
|
@@ -355,7 +355,7 @@ function safe_fetch_options(cb, f) {
|
|
|
355
355
|
url: _url
|
|
356
356
|
});
|
|
357
357
|
}).then(function (res) {
|
|
358
|
-
return expect_array(res.data).map(function (_) {
|
|
358
|
+
return expect_array(dataPath ? get(res.data, dataPath) : res.data).map(function (_) {
|
|
359
359
|
return {
|
|
360
360
|
label: get(_, labelKey),
|
|
361
361
|
value: get(_, valueKey)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noah-libjs/request",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@noah-libjs/utils": "^0.0.
|
|
24
|
+
"@noah-libjs/utils": "^0.0.70",
|
|
25
25
|
"axios": "^0.26.1",
|
|
26
26
|
"store": "2.x"
|
|
27
27
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"keywords": [],
|
|
33
33
|
"author": "",
|
|
34
34
|
"license": "MIT",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "fd9f5e38e03df6c561b626b00f6537478cdf0f38"
|
|
36
36
|
}
|