aq-fe-framework 0.1.695 → 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.
@@ -29,6 +29,13 @@ interface IEmailConfig extends IBaseEntity {
29
29
  userName?: string;
30
30
  }
31
31
 
32
+ interface IEmailTemplate extends IBaseEntity {
33
+ order: number;
34
+ body: string;
35
+ type: number;
36
+ aqModuleId: number;
37
+ }
38
+
32
39
  interface IRole extends IBaseEntity {
33
40
  isCreate?: boolean;
34
41
  isUpdate?: boolean;
@@ -43,4 +50,4 @@ interface IRole extends IBaseEntity {
43
50
  aqModuleId?: number;
44
51
  }
45
52
 
46
- export type { AcademicYearUpdateDto as A, IAcademicYear as I, IEmailConfig as a, IRole as b };
53
+ export type { AcademicYearUpdateDto as A, IAcademicYear as I, IEmailConfig as a, IEmailTemplate as b, IRole as c };
@@ -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 = useQuery(__spreadValues({
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 useQuery2 } from "@tanstack/react-query";
404
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
379
405
  function useQ_AQ_GetAQModule() {
380
- const query = useQuery2({
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 useQuery3 } from "@tanstack/react-query";
421
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
396
422
  function useQ_SkillCenter_GetAll() {
397
- const query = useQuery3({
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,