aq-fe-framework 0.1.697 → 0.1.698
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/{chunk-6OH47R5O.mjs → chunk-DNMB3Q4N.mjs} +33 -6
- package/dist/{chunk-NHBUWP2U.mjs → chunk-XNAWBDT5.mjs} +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/coreService/index.mjs +2 -2
- package/dist/hooks/index.d.mts +6 -1
- package/dist/hooks/index.mjs +3 -1
- package/dist/modules-features/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -198,6 +198,32 @@ function createMapper(config) {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// src/hooks/custom-hooks/useConfig.ts
|
|
202
|
+
import { useQuery } from "@tanstack/react-query";
|
|
203
|
+
async function fetchConfig(configPath) {
|
|
204
|
+
const res = await fetch(configPath);
|
|
205
|
+
if (!res.ok) {
|
|
206
|
+
throw new Error(`Kh\xF4ng th\u1EC3 t\u1EA3i config t\u1EEB ${configPath}`);
|
|
207
|
+
}
|
|
208
|
+
return res.json();
|
|
209
|
+
}
|
|
210
|
+
function useConfig({
|
|
211
|
+
configPath = "/config.json",
|
|
212
|
+
key
|
|
213
|
+
}) {
|
|
214
|
+
return useQuery({
|
|
215
|
+
queryKey: ["config", configPath],
|
|
216
|
+
queryFn: () => fetchConfig(configPath),
|
|
217
|
+
select: (config) => {
|
|
218
|
+
if (!(key in config)) {
|
|
219
|
+
throw new Error(`Key "${key}" kh\xF4ng t\u1ED3n t\u1EA1i trong config`);
|
|
220
|
+
}
|
|
221
|
+
return config[key];
|
|
222
|
+
},
|
|
223
|
+
staleTime: 1e3 * 60 * 5
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
201
227
|
// src/hooks/custom-hooks/useMyReactMutation.ts
|
|
202
228
|
import { notifications } from "@mantine/notifications";
|
|
203
229
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
@@ -253,7 +279,7 @@ function useMyReactMutation({
|
|
|
253
279
|
}
|
|
254
280
|
|
|
255
281
|
// src/hooks/custom-hooks/useMyReactQuery.ts
|
|
256
|
-
import { useQuery } from "@tanstack/react-query";
|
|
282
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
257
283
|
import { useState as useState2 } from "react";
|
|
258
284
|
function useMyReactQuery({
|
|
259
285
|
queryKey,
|
|
@@ -262,7 +288,7 @@ function useMyReactQuery({
|
|
|
262
288
|
mockData
|
|
263
289
|
}) {
|
|
264
290
|
const [dataCount, setDataCount] = useState2(0);
|
|
265
|
-
const queryResult =
|
|
291
|
+
const queryResult = useQuery2(__spreadValues({
|
|
266
292
|
queryKey: queryKey != null ? queryKey : [],
|
|
267
293
|
enabled: !!queryKey,
|
|
268
294
|
queryFn: async () => {
|
|
@@ -375,9 +401,9 @@ var useLoadAxiosConfig = ({
|
|
|
375
401
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
376
402
|
|
|
377
403
|
// src/hooks/query/AQ/useQ_AQ_GetAQModule.ts
|
|
378
|
-
import { useQuery as
|
|
404
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
379
405
|
function useQ_AQ_GetAQModule() {
|
|
380
|
-
const query =
|
|
406
|
+
const query = useQuery3({
|
|
381
407
|
queryKey: ["/AQ/GetAQModule"],
|
|
382
408
|
queryFn: async () => {
|
|
383
409
|
const res = await baseAxios_default.get("/AQ/GetAQModule");
|
|
@@ -392,9 +418,9 @@ function useQ_AQ_GetAQModule() {
|
|
|
392
418
|
}
|
|
393
419
|
|
|
394
420
|
// src/hooks/query/SkillCenter/useQ_SkillCenter_GetAll.ts
|
|
395
|
-
import { useQuery as
|
|
421
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
396
422
|
function useQ_SkillCenter_GetAll() {
|
|
397
|
-
const query =
|
|
423
|
+
const query = useQuery4({
|
|
398
424
|
queryKey: [],
|
|
399
425
|
queryFn: async () => {
|
|
400
426
|
const res = await baseAxios_default.get("/SkillCenter/GetAll");
|
|
@@ -412,6 +438,7 @@ export {
|
|
|
412
438
|
createBaseApi,
|
|
413
439
|
createBaseUrl,
|
|
414
440
|
createMapper,
|
|
441
|
+
useConfig,
|
|
415
442
|
useMyReactMutation,
|
|
416
443
|
useMyReactQuery,
|
|
417
444
|
useCrudService,
|
|
@@ -70,14 +70,14 @@ import {
|
|
|
70
70
|
useHeaderMegaMenuStore,
|
|
71
71
|
useS_ButtonImport,
|
|
72
72
|
useStore_BasicAppShell
|
|
73
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-XNAWBDT5.mjs";
|
|
74
74
|
import "../chunk-SUH3FFFV.mjs";
|
|
75
75
|
import "../chunk-2B2FKBKX.mjs";
|
|
76
76
|
import "../chunk-7PUDC2WF.mjs";
|
|
77
77
|
import "../chunk-EWDS5IOF.mjs";
|
|
78
78
|
import "../chunk-IUTUR43V.mjs";
|
|
79
79
|
import "../chunk-K6S7R6LU.mjs";
|
|
80
|
-
import "../chunk-
|
|
80
|
+
import "../chunk-DNMB3Q4N.mjs";
|
|
81
81
|
import "../chunk-WZ6PXGGC.mjs";
|
|
82
82
|
import "../chunk-7ZCOFATU.mjs";
|
|
83
83
|
import "../chunk-FWCSY2DS.mjs";
|
package/dist/core/index.mjs
CHANGED
|
@@ -25,14 +25,14 @@ import {
|
|
|
25
25
|
MyStatsCard,
|
|
26
26
|
MyTextInput2 as MyTextInput,
|
|
27
27
|
MyWeeklySessionSchedulerPicker
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-XNAWBDT5.mjs";
|
|
29
29
|
import "../chunk-SUH3FFFV.mjs";
|
|
30
30
|
import "../chunk-2B2FKBKX.mjs";
|
|
31
31
|
import "../chunk-7PUDC2WF.mjs";
|
|
32
32
|
import "../chunk-EWDS5IOF.mjs";
|
|
33
33
|
import "../chunk-IUTUR43V.mjs";
|
|
34
34
|
import "../chunk-K6S7R6LU.mjs";
|
|
35
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-DNMB3Q4N.mjs";
|
|
36
36
|
import "../chunk-WZ6PXGGC.mjs";
|
|
37
37
|
import "../chunk-7ZCOFATU.mjs";
|
|
38
38
|
import "../chunk-FWCSY2DS.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MyModalDelete
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-XNAWBDT5.mjs";
|
|
4
4
|
import "../chunk-SUH3FFFV.mjs";
|
|
5
5
|
import "../chunk-2B2FKBKX.mjs";
|
|
6
6
|
import "../chunk-7PUDC2WF.mjs";
|
|
@@ -9,7 +9,7 @@ import "../chunk-IUTUR43V.mjs";
|
|
|
9
9
|
import "../chunk-K6S7R6LU.mjs";
|
|
10
10
|
import {
|
|
11
11
|
useMyReactMutation
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-DNMB3Q4N.mjs";
|
|
13
13
|
import "../chunk-WZ6PXGGC.mjs";
|
|
14
14
|
import "../chunk-7ZCOFATU.mjs";
|
|
15
15
|
import {
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -78,6 +78,11 @@ declare function createMapper<UI, API>(config: MapperConfig<UI, API>): {
|
|
|
78
78
|
toUI: (apiData: API) => UI;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
declare function useConfig({ configPath, key }: {
|
|
82
|
+
configPath?: string;
|
|
83
|
+
key: string;
|
|
84
|
+
}): _tanstack_react_query.UseQueryResult<any, Error>;
|
|
85
|
+
|
|
81
86
|
declare function useCrudService<T>(service: BaseApiType<T>, queryKey: QueryKey): {
|
|
82
87
|
query: {
|
|
83
88
|
dataCount: number;
|
|
@@ -428,4 +433,4 @@ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options, mock
|
|
|
428
433
|
|
|
429
434
|
declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
|
|
430
435
|
|
|
431
|
-
export { BaseApiType, MyApiResponse, type MyReactQueryProps, createBaseUrl, createMapper, useCreateUpdate, useCrudService, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
|
|
436
|
+
export { BaseApiType, MyApiResponse, type MyReactQueryProps, createBaseUrl, createMapper, useConfig, useCreateUpdate, useCrudService, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
createBaseApi,
|
|
3
3
|
createBaseUrl,
|
|
4
4
|
createMapper,
|
|
5
|
+
useConfig,
|
|
5
6
|
useCreateUpdate,
|
|
6
7
|
useCrudService,
|
|
7
8
|
useEditableRows,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
useMyReactQuery,
|
|
12
13
|
useMyRouter,
|
|
13
14
|
useQ_AQ_GetAQModule
|
|
14
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-DNMB3Q4N.mjs";
|
|
15
16
|
import "../chunk-WZ6PXGGC.mjs";
|
|
16
17
|
import "../chunk-7ZCOFATU.mjs";
|
|
17
18
|
import "../chunk-FWCSY2DS.mjs";
|
|
@@ -19,6 +20,7 @@ export {
|
|
|
19
20
|
createBaseApi,
|
|
20
21
|
createBaseUrl,
|
|
21
22
|
createMapper,
|
|
23
|
+
useConfig,
|
|
22
24
|
useCreateUpdate,
|
|
23
25
|
useCrudService,
|
|
24
26
|
useEditableRows,
|
|
@@ -116,14 +116,14 @@ import {
|
|
|
116
116
|
MailTemplateDeleteButton,
|
|
117
117
|
useS_authenticate,
|
|
118
118
|
useS_moduleConfig
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-XNAWBDT5.mjs";
|
|
120
120
|
import "../chunk-SUH3FFFV.mjs";
|
|
121
121
|
import "../chunk-2B2FKBKX.mjs";
|
|
122
122
|
import "../chunk-7PUDC2WF.mjs";
|
|
123
123
|
import "../chunk-EWDS5IOF.mjs";
|
|
124
124
|
import "../chunk-IUTUR43V.mjs";
|
|
125
125
|
import "../chunk-K6S7R6LU.mjs";
|
|
126
|
-
import "../chunk-
|
|
126
|
+
import "../chunk-DNMB3Q4N.mjs";
|
|
127
127
|
import "../chunk-WZ6PXGGC.mjs";
|
|
128
128
|
import "../chunk-7ZCOFATU.mjs";
|
|
129
129
|
import "../chunk-FWCSY2DS.mjs";
|