next-recomponents 1.5.93 → 1.5.95
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +184 -200
- package/dist/index.mjs +185 -201
- package/package.json +1 -1
- package/src/use-resources/index.ts +202 -469
package/dist/index.d.mts
CHANGED
|
@@ -89,7 +89,7 @@ interface Props$1 {
|
|
|
89
89
|
onError?: (error: any) => void;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1): any
|
|
92
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1): Record<string, any>;
|
|
93
93
|
|
|
94
94
|
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
95
95
|
label?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -89,7 +89,7 @@ interface Props$1 {
|
|
|
89
89
|
onError?: (error: any) => void;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1): any
|
|
92
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1): Record<string, any>;
|
|
93
93
|
|
|
94
94
|
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
95
95
|
label?: string;
|
package/dist/index.js
CHANGED
|
@@ -32291,64 +32291,17 @@ function useResources({
|
|
|
32291
32291
|
}) {
|
|
32292
32292
|
const token = useToken();
|
|
32293
32293
|
const [info, setInfo] = (0, import_react28.useState)({});
|
|
32294
|
-
|
|
32295
|
-
|
|
32296
|
-
|
|
32297
|
-
|
|
32298
|
-
|
|
32299
|
-
|
|
32300
|
-
limit = 10,
|
|
32301
|
-
page = 1,
|
|
32302
|
-
merge = true
|
|
32303
|
-
} = _b, query = __objRest(_b, [
|
|
32304
|
-
"limit",
|
|
32305
|
-
"page",
|
|
32306
|
-
"merge"
|
|
32307
|
-
]);
|
|
32308
|
-
const options = {
|
|
32309
|
-
method: "GET",
|
|
32310
|
-
url: `${baseURI}/${key}`,
|
|
32311
|
-
params: __spreadValues({ limit, page }, query),
|
|
32312
|
-
headers: { Authorization: token }
|
|
32313
|
-
};
|
|
32314
|
-
const newInfo = __spreadValues({}, info);
|
|
32315
|
-
newInfo[key] = newInfo[key] || {};
|
|
32316
|
-
newInfo[key].state = "loading";
|
|
32317
|
-
newInfo[key].errorMessage = "";
|
|
32318
|
-
newInfo[key].params = query;
|
|
32319
|
-
newInfo[key].loaded = true;
|
|
32320
|
-
setInfo(newInfo);
|
|
32321
|
-
try {
|
|
32322
|
-
const consulta = yield import_axios.default.request(options);
|
|
32323
|
-
const d = consulta.data;
|
|
32324
|
-
newInfo[key].state = "success";
|
|
32325
|
-
newInfo[key].errorMessage = "";
|
|
32326
|
-
newInfo[key].data = merge ? page == 1 ? d.data : [...d.data, ...newInfo[key].data || []] : d.data;
|
|
32327
|
-
newInfo[key].totalItems = d.totalItems;
|
|
32328
|
-
newInfo[key].totalPages = d.totalPages;
|
|
32329
|
-
newInfo[key].currentPage = d.currentPage;
|
|
32330
|
-
setInfo(__spreadValues({}, newInfo));
|
|
32331
|
-
return d.data;
|
|
32332
|
-
} catch (error) {
|
|
32333
|
-
const item = http_codes_default.find((s) => s.code == error.status);
|
|
32334
|
-
newInfo[key].state = "error";
|
|
32335
|
-
newInfo[key].errorMessage = item == null ? void 0 : item.meaning;
|
|
32336
|
-
if (error.status == 403) {
|
|
32337
|
-
onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
|
|
32338
|
-
}
|
|
32339
|
-
setInfo(__spreadValues({}, newInfo));
|
|
32340
|
-
return error;
|
|
32341
|
-
}
|
|
32342
|
-
});
|
|
32343
|
-
acc[key] = __spreadProps(__spreadValues({}, endpoint), {
|
|
32344
|
-
loaded: false,
|
|
32345
|
-
show: showFunc,
|
|
32346
|
-
find: (id3, query) => __async(null, null, function* () {
|
|
32347
|
-
var _a, _b, _c2;
|
|
32294
|
+
(0, import_react28.useEffect)(() => {
|
|
32295
|
+
setInfo(
|
|
32296
|
+
Object.keys(endpoints).reduce((acc, key) => {
|
|
32297
|
+
var _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
32298
|
+
const endpoint = endpoints[key];
|
|
32299
|
+
const showFunc = (_a, autoLoad = false) => __async(null, null, function* () {
|
|
32300
|
+
var _b = _a, { limit = 10, page = 1, merge = true } = _b, query = __objRest(_b, ["limit", "page", "merge"]);
|
|
32348
32301
|
const options = {
|
|
32349
32302
|
method: "GET",
|
|
32350
|
-
url: `${baseURI}/${key}
|
|
32351
|
-
params: __spreadValues({}, query),
|
|
32303
|
+
url: `${baseURI}/${key}`,
|
|
32304
|
+
params: __spreadValues({ limit, page }, query),
|
|
32352
32305
|
headers: { Authorization: token }
|
|
32353
32306
|
};
|
|
32354
32307
|
const newInfo = __spreadValues({}, info);
|
|
@@ -32356,81 +32309,63 @@ function useResources({
|
|
|
32356
32309
|
newInfo[key].state = "loading";
|
|
32357
32310
|
newInfo[key].errorMessage = "";
|
|
32358
32311
|
newInfo[key].params = query;
|
|
32359
|
-
newInfo[key].
|
|
32312
|
+
newInfo[key].loaded = true;
|
|
32360
32313
|
setInfo(newInfo);
|
|
32361
32314
|
try {
|
|
32362
32315
|
const consulta = yield import_axios.default.request(options);
|
|
32363
32316
|
const d = consulta.data;
|
|
32364
32317
|
newInfo[key].state = "success";
|
|
32365
32318
|
newInfo[key].errorMessage = "";
|
|
32366
|
-
|
|
32367
|
-
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32368
|
-
(d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
|
|
32369
|
-
);
|
|
32370
|
-
if (index >= 0) {
|
|
32371
|
-
newInfo[key].data[index] = d;
|
|
32319
|
+
if (autoLoad) {
|
|
32372
32320
|
} else {
|
|
32373
|
-
|
|
32374
|
-
|
|
32375
|
-
|
|
32376
|
-
|
|
32377
|
-
}
|
|
32321
|
+
newInfo[key].data = merge ? page == 1 ? d.data : [...d.data, ...newInfo[key].data || []] : d.data;
|
|
32322
|
+
newInfo[key].totalItems = d.totalItems;
|
|
32323
|
+
newInfo[key].totalPages = d.totalPages;
|
|
32324
|
+
newInfo[key].currentPage = d.currentPage;
|
|
32378
32325
|
}
|
|
32379
32326
|
setInfo(__spreadValues({}, newInfo));
|
|
32380
|
-
return d;
|
|
32327
|
+
return d.data;
|
|
32381
32328
|
} catch (error) {
|
|
32382
32329
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
32383
32330
|
newInfo[key].state = "error";
|
|
32384
|
-
newInfo[key].errorMessage =
|
|
32331
|
+
newInfo[key].errorMessage = item == null ? void 0 : item.meaning;
|
|
32385
32332
|
if (error.status == 403) {
|
|
32386
32333
|
onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
|
|
32387
32334
|
}
|
|
32388
32335
|
setInfo(__spreadValues({}, newInfo));
|
|
32389
32336
|
return error;
|
|
32390
32337
|
}
|
|
32391
|
-
})
|
|
32392
|
-
|
|
32393
|
-
var _a, _b, _c2
|
|
32338
|
+
});
|
|
32339
|
+
const findFunc = (id3, query, autoLoad = false) => __async(null, null, function* () {
|
|
32340
|
+
var _a, _b, _c2;
|
|
32394
32341
|
const options = {
|
|
32395
|
-
method: "
|
|
32396
|
-
url: `${baseURI}/${key}`,
|
|
32397
|
-
|
|
32342
|
+
method: "GET",
|
|
32343
|
+
url: `${baseURI}/${key}/${id3}`,
|
|
32344
|
+
params: __spreadValues({}, query),
|
|
32398
32345
|
headers: { Authorization: token }
|
|
32399
32346
|
};
|
|
32400
32347
|
const newInfo = __spreadValues({}, info);
|
|
32401
32348
|
newInfo[key] = newInfo[key] || {};
|
|
32402
32349
|
newInfo[key].state = "loading";
|
|
32403
32350
|
newInfo[key].errorMessage = "";
|
|
32351
|
+
newInfo[key].params = query;
|
|
32352
|
+
newInfo[key].loader = true;
|
|
32404
32353
|
setInfo(newInfo);
|
|
32405
32354
|
try {
|
|
32406
32355
|
const consulta = yield import_axios.default.request(options);
|
|
32407
32356
|
const d = consulta.data;
|
|
32408
32357
|
newInfo[key].state = "success";
|
|
32409
32358
|
newInfo[key].errorMessage = "";
|
|
32410
|
-
if (
|
|
32411
|
-
for (let datum of data) {
|
|
32412
|
-
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32413
|
-
(d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
|
|
32414
|
-
);
|
|
32415
|
-
if (index >= 0) {
|
|
32416
|
-
newInfo[key].data[index] = d;
|
|
32417
|
-
} else {
|
|
32418
|
-
if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
|
|
32419
|
-
newInfo[key].data.unshift(d);
|
|
32420
|
-
} else {
|
|
32421
|
-
newInfo[key].data = [d];
|
|
32422
|
-
}
|
|
32423
|
-
}
|
|
32424
|
-
}
|
|
32359
|
+
if (autoLoad) {
|
|
32425
32360
|
} else {
|
|
32426
32361
|
newInfo[key].selectedItem = d;
|
|
32427
|
-
const index = (
|
|
32362
|
+
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32428
32363
|
(d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
|
|
32429
32364
|
);
|
|
32430
32365
|
if (index >= 0) {
|
|
32431
32366
|
newInfo[key].data[index] = d;
|
|
32432
32367
|
} else {
|
|
32433
|
-
if ((
|
|
32368
|
+
if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
|
|
32434
32369
|
newInfo[key].data.unshift(d);
|
|
32435
32370
|
} else {
|
|
32436
32371
|
newInfo[key].data = [d];
|
|
@@ -32449,120 +32384,169 @@ function useResources({
|
|
|
32449
32384
|
setInfo(__spreadValues({}, newInfo));
|
|
32450
32385
|
return error;
|
|
32451
32386
|
}
|
|
32452
|
-
})
|
|
32453
|
-
|
|
32454
|
-
|
|
32455
|
-
|
|
32456
|
-
|
|
32457
|
-
|
|
32458
|
-
|
|
32459
|
-
|
|
32460
|
-
|
|
32461
|
-
|
|
32462
|
-
|
|
32463
|
-
|
|
32464
|
-
|
|
32465
|
-
|
|
32466
|
-
|
|
32467
|
-
|
|
32468
|
-
const d = consulta.data;
|
|
32469
|
-
newInfo[key].state = "success";
|
|
32387
|
+
});
|
|
32388
|
+
acc[key] = __spreadProps(__spreadValues({}, endpoint), {
|
|
32389
|
+
loaded: !((_c = acc[key]) == null ? void 0 : _c.loaded) ? ((_d = acc[key]) == null ? void 0 : _d.id) ? findFunc(acc[key].id, (_e = acc[key]) == null ? void 0 : _e.defaultParams) : ((_f = acc[key]) == null ? void 0 : _f.defaultParams) ? showFunc(acc[key].defaultParams) : true : true,
|
|
32390
|
+
show: showFunc,
|
|
32391
|
+
find: findFunc,
|
|
32392
|
+
create: (data) => __async(null, null, function* () {
|
|
32393
|
+
var _a, _b, _c2, _d2, _e2, _f2;
|
|
32394
|
+
const options = {
|
|
32395
|
+
method: "POST",
|
|
32396
|
+
url: `${baseURI}/${key}`,
|
|
32397
|
+
data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
|
|
32398
|
+
headers: { Authorization: token }
|
|
32399
|
+
};
|
|
32400
|
+
const newInfo = __spreadValues({}, info);
|
|
32401
|
+
newInfo[key] = newInfo[key] || {};
|
|
32402
|
+
newInfo[key].state = "loading";
|
|
32470
32403
|
newInfo[key].errorMessage = "";
|
|
32471
|
-
newInfo
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
|
|
32476
|
-
newInfo[key].
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
|
|
32404
|
+
setInfo(newInfo);
|
|
32405
|
+
try {
|
|
32406
|
+
const consulta = yield import_axios.default.request(options);
|
|
32407
|
+
const d = consulta.data;
|
|
32408
|
+
newInfo[key].state = "success";
|
|
32409
|
+
newInfo[key].errorMessage = "";
|
|
32410
|
+
if (Array.isArray(data)) {
|
|
32411
|
+
for (let datum of data) {
|
|
32412
|
+
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32413
|
+
(d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
|
|
32414
|
+
);
|
|
32415
|
+
if (index >= 0) {
|
|
32416
|
+
newInfo[key].data[index] = d;
|
|
32417
|
+
} else {
|
|
32418
|
+
if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
|
|
32419
|
+
newInfo[key].data.unshift(d);
|
|
32420
|
+
} else {
|
|
32421
|
+
newInfo[key].data = [d];
|
|
32422
|
+
}
|
|
32423
|
+
}
|
|
32424
|
+
}
|
|
32480
32425
|
} else {
|
|
32481
|
-
newInfo[key].
|
|
32426
|
+
newInfo[key].selectedItem = d;
|
|
32427
|
+
const index = (_e2 = (_d2 = newInfo[key]) == null ? void 0 : _d2.data) == null ? void 0 : _e2.findIndex(
|
|
32428
|
+
(d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
|
|
32429
|
+
);
|
|
32430
|
+
if (index >= 0) {
|
|
32431
|
+
newInfo[key].data[index] = d;
|
|
32432
|
+
} else {
|
|
32433
|
+
if ((_f2 = newInfo[key]) == null ? void 0 : _f2.data) {
|
|
32434
|
+
newInfo[key].data.unshift(d);
|
|
32435
|
+
} else {
|
|
32436
|
+
newInfo[key].data = [d];
|
|
32437
|
+
}
|
|
32438
|
+
}
|
|
32482
32439
|
}
|
|
32440
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32441
|
+
return d;
|
|
32442
|
+
} catch (error) {
|
|
32443
|
+
const item = http_codes_default.find((s) => s.code == error.status);
|
|
32444
|
+
newInfo[key].state = "error";
|
|
32445
|
+
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
32446
|
+
if (error.status == 403) {
|
|
32447
|
+
onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
|
|
32448
|
+
}
|
|
32449
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32450
|
+
return error;
|
|
32483
32451
|
}
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
const
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
}
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
}),
|
|
32497
|
-
remove: (id3) => __async(null, null, function* () {
|
|
32498
|
-
var _a, _b;
|
|
32499
|
-
const options = {
|
|
32500
|
-
method: "DELETE",
|
|
32501
|
-
url: `${baseURI}/${key}/${id3}`,
|
|
32502
|
-
headers: { Authorization: token }
|
|
32503
|
-
};
|
|
32504
|
-
const newInfo = __spreadValues({}, info);
|
|
32505
|
-
newInfo[key] = newInfo[key] || {};
|
|
32506
|
-
newInfo[key].state = "loading";
|
|
32507
|
-
newInfo[key].errorMessage = "";
|
|
32508
|
-
setInfo(newInfo);
|
|
32509
|
-
try {
|
|
32510
|
-
const consulta = yield import_axios.default.request(options);
|
|
32511
|
-
const d = consulta.data;
|
|
32512
|
-
newInfo[key].state = "success";
|
|
32452
|
+
}),
|
|
32453
|
+
update: (id3, data) => __async(null, null, function* () {
|
|
32454
|
+
var _a, _b, _c2;
|
|
32455
|
+
const options = {
|
|
32456
|
+
method: "PATCH",
|
|
32457
|
+
url: `${baseURI}/${key}/${id3}`,
|
|
32458
|
+
data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
|
|
32459
|
+
headers: { Authorization: token }
|
|
32460
|
+
};
|
|
32461
|
+
const newInfo = __spreadValues({}, info);
|
|
32462
|
+
newInfo[key] = newInfo[key] || {};
|
|
32463
|
+
newInfo[key].state = "loading";
|
|
32513
32464
|
newInfo[key].errorMessage = "";
|
|
32514
|
-
newInfo
|
|
32515
|
-
|
|
32516
|
-
|
|
32517
|
-
|
|
32518
|
-
|
|
32519
|
-
newInfo[key].
|
|
32465
|
+
setInfo(newInfo);
|
|
32466
|
+
try {
|
|
32467
|
+
const consulta = yield import_axios.default.request(options);
|
|
32468
|
+
const d = consulta.data;
|
|
32469
|
+
newInfo[key].state = "success";
|
|
32470
|
+
newInfo[key].errorMessage = "";
|
|
32471
|
+
newInfo[key].selectedItem = d;
|
|
32472
|
+
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32473
|
+
(d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
|
|
32474
|
+
);
|
|
32475
|
+
if (index >= 0) {
|
|
32476
|
+
newInfo[key].data[index] = d;
|
|
32477
|
+
} else {
|
|
32478
|
+
if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
|
|
32479
|
+
newInfo[key].data.unshift(d);
|
|
32480
|
+
} else {
|
|
32481
|
+
newInfo[key].data = [d];
|
|
32482
|
+
}
|
|
32483
|
+
}
|
|
32484
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32485
|
+
return d;
|
|
32486
|
+
} catch (error) {
|
|
32487
|
+
const item = http_codes_default.find((s) => s.code == error.status);
|
|
32488
|
+
newInfo[key].state = "error";
|
|
32489
|
+
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
32490
|
+
if (error.status == 403) {
|
|
32491
|
+
onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
|
|
32492
|
+
}
|
|
32493
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32494
|
+
return error;
|
|
32520
32495
|
}
|
|
32521
|
-
|
|
32522
|
-
|
|
32523
|
-
|
|
32524
|
-
const
|
|
32525
|
-
|
|
32526
|
-
|
|
32527
|
-
|
|
32528
|
-
|
|
32496
|
+
}),
|
|
32497
|
+
remove: (id3) => __async(null, null, function* () {
|
|
32498
|
+
var _a, _b;
|
|
32499
|
+
const options = {
|
|
32500
|
+
method: "DELETE",
|
|
32501
|
+
url: `${baseURI}/${key}/${id3}`,
|
|
32502
|
+
headers: { Authorization: token }
|
|
32503
|
+
};
|
|
32504
|
+
const newInfo = __spreadValues({}, info);
|
|
32505
|
+
newInfo[key] = newInfo[key] || {};
|
|
32506
|
+
newInfo[key].state = "loading";
|
|
32507
|
+
newInfo[key].errorMessage = "";
|
|
32508
|
+
setInfo(newInfo);
|
|
32509
|
+
try {
|
|
32510
|
+
const consulta = yield import_axios.default.request(options);
|
|
32511
|
+
const d = consulta.data;
|
|
32512
|
+
newInfo[key].state = "success";
|
|
32513
|
+
newInfo[key].errorMessage = "";
|
|
32514
|
+
newInfo[key].selectedItem = d;
|
|
32515
|
+
const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
|
|
32516
|
+
(d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
|
|
32517
|
+
);
|
|
32518
|
+
if (index >= 0) {
|
|
32519
|
+
newInfo[key].data.splice(index, 1);
|
|
32520
|
+
}
|
|
32521
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32522
|
+
return d.data;
|
|
32523
|
+
} catch (error) {
|
|
32524
|
+
const item = http_codes_default.find((s) => s.code == error.status);
|
|
32525
|
+
newInfo[key].state = "error";
|
|
32526
|
+
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
32527
|
+
if (error.status == 403) {
|
|
32528
|
+
onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
|
|
32529
|
+
}
|
|
32530
|
+
setInfo(__spreadValues({}, newInfo));
|
|
32531
|
+
return error;
|
|
32529
32532
|
}
|
|
32530
|
-
|
|
32531
|
-
|
|
32532
|
-
|
|
32533
|
-
|
|
32534
|
-
|
|
32535
|
-
|
|
32536
|
-
|
|
32537
|
-
|
|
32538
|
-
|
|
32539
|
-
|
|
32540
|
-
|
|
32541
|
-
})
|
|
32542
|
-
|
|
32543
|
-
|
|
32544
|
-
|
|
32545
|
-
|
|
32546
|
-
|
|
32547
|
-
}, [info, token, endpoints]);
|
|
32548
|
-
function loadAll() {
|
|
32549
|
-
return __async(this, null, function* () {
|
|
32550
|
-
var _a, _b;
|
|
32551
|
-
for (let item in result) {
|
|
32552
|
-
if (((_a = result[item]) == null ? void 0 : _a.id) && !result[item].loaded) {
|
|
32553
|
-
yield result[item].find(result[item].id, __spreadValues({}, result[item].defaultParams));
|
|
32554
|
-
return;
|
|
32555
|
-
} else if (((_b = result[item]) == null ? void 0 : _b.defaultParams) && !result[item].loaded) {
|
|
32556
|
-
yield result[item].show(__spreadValues({}, result[item].defaultParams));
|
|
32557
|
-
return;
|
|
32558
|
-
}
|
|
32559
|
-
}
|
|
32560
|
-
});
|
|
32561
|
-
}
|
|
32562
|
-
(0, import_react28.useEffect)(() => {
|
|
32563
|
-
loadAll();
|
|
32564
|
-
}, []);
|
|
32565
|
-
return result;
|
|
32533
|
+
}),
|
|
32534
|
+
totalPages: (_g = info[key]) == null ? void 0 : _g.totalPages,
|
|
32535
|
+
currentPage: (_h = info[key]) == null ? void 0 : _h.currentPage,
|
|
32536
|
+
state: ((_i = info[key]) == null ? void 0 : _i.state) || "success",
|
|
32537
|
+
errorMessage: (_j = info[key]) == null ? void 0 : _j.errorMessage,
|
|
32538
|
+
params: (_k = info[key]) == null ? void 0 : _k.params,
|
|
32539
|
+
getAllPages: (limit = 10) => __async(null, null, function* () {
|
|
32540
|
+
console.log("Not aviable");
|
|
32541
|
+
}),
|
|
32542
|
+
data: ((_l = info[key]) == null ? void 0 : _l.data) || [],
|
|
32543
|
+
selectedItem: ((_m = info[key]) == null ? void 0 : _m.selectedItem) || {}
|
|
32544
|
+
});
|
|
32545
|
+
return acc;
|
|
32546
|
+
}, {})
|
|
32547
|
+
);
|
|
32548
|
+
}, [endpoints]);
|
|
32549
|
+
return info;
|
|
32566
32550
|
}
|
|
32567
32551
|
|
|
32568
32552
|
// src/select/index.tsx
|