aq-fe-framework 0.1.205 → 0.1.206

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.
@@ -89,6 +89,21 @@ function useMyReactMutation({
89
89
 
90
90
  // src/hooks/custom-hooks/useMyReactQuery.ts
91
91
  import { useQuery } from "@tanstack/react-query";
92
+ function useMyReactQuery({
93
+ queryKey,
94
+ axiosFn,
95
+ options
96
+ }) {
97
+ return useQuery(__spreadValues({
98
+ queryKey,
99
+ // bạn tự thêm queryKey khi dùng nhé
100
+ queryFn: async () => {
101
+ const res = await axiosFn();
102
+ if (res.data.isSuccess == 0) throw new Error(res.data.message);
103
+ return res.data.data;
104
+ }
105
+ }, options));
106
+ }
92
107
 
93
108
  // src/hooks/query/AQ/useQ_AQ_GetAQModule.ts
94
109
  import { useQuery as useQuery2 } from "@tanstack/react-query";
@@ -122,5 +137,6 @@ export {
122
137
  useLoadConfig,
123
138
  createBaseApi,
124
139
  useMyReactMutation,
140
+ useMyReactQuery,
125
141
  useQ_SkillCenter_GetAll
126
142
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  baseAxios_default,
3
3
  useQ_AQ_GetAQModule
4
- } from "./chunk-CUMGXY5T.mjs";
4
+ } from "./chunk-3ZDIILYJ.mjs";
5
5
  import {
6
6
  createGenericStore
7
7
  } from "./chunk-Y3YGC5IH.mjs";
@@ -66,8 +66,8 @@ import {
66
66
  useS_BasicAppShell,
67
67
  useS_ButtonImport,
68
68
  utils_layout_getItemsWithoutLinks
69
- } from "../chunk-DTTVAJG7.mjs";
70
- import "../chunk-CUMGXY5T.mjs";
69
+ } from "../chunk-C4U5O7IJ.mjs";
70
+ import "../chunk-3ZDIILYJ.mjs";
71
71
  import "../chunk-Y3YGC5IH.mjs";
72
72
  import "../chunk-5U2JSHSJ.mjs";
73
73
  import "../chunk-7ZCOFATU.mjs";
@@ -1,7 +1,7 @@
1
1
  import * as axios from 'axios';
2
2
  import { AxiosInstance, AxiosResponse } from 'axios';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
- import { UseMutationOptions } from '@tanstack/react-query';
4
+ import { UseMutationOptions, QueryKey, UseQueryOptions } from '@tanstack/react-query';
5
5
  import { I as IAQModule } from '../IAQModule-XZYlbivW.mjs';
6
6
 
7
7
  declare const useLoadConfig: () => void;
@@ -26,6 +26,13 @@ interface MyReactMutationProps<IReq, IRes> {
26
26
  }
27
27
  declare function useMyReactMutation<IReq, IRes>({ axiosFn, options, }: MyReactMutationProps<IReq, IRes>): _tanstack_react_query.UseMutationResult<IRes, Error, IReq, unknown>;
28
28
 
29
+ interface MyReactQueryProps<IRes, IBody> {
30
+ queryKey: QueryKey;
31
+ axiosFn: () => Promise<AxiosResponse<MyApiResponse<IRes>, IBody>>;
32
+ options?: Partial<UseQueryOptions<IRes, Error>>;
33
+ }
34
+ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options }: MyReactQueryProps<IRes, IBody>): _tanstack_react_query.UseQueryResult<IRes, Error>;
35
+
29
36
  declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
30
37
 
31
- export { type MyApiResponse, createBaseApi, useLoadConfig, useMyReactMutation, useQ_AQ_GetAQModule };
38
+ export { type MyApiResponse, createBaseApi, useLoadConfig, useMyReactMutation, useMyReactQuery, useQ_AQ_GetAQModule };
@@ -2,13 +2,15 @@ import {
2
2
  createBaseApi,
3
3
  useLoadConfig,
4
4
  useMyReactMutation,
5
+ useMyReactQuery,
5
6
  useQ_AQ_GetAQModule
6
- } from "../chunk-CUMGXY5T.mjs";
7
+ } from "../chunk-3ZDIILYJ.mjs";
7
8
  import "../chunk-7ZCOFATU.mjs";
8
9
  import "../chunk-FWCSY2DS.mjs";
9
10
  export {
10
11
  createBaseApi,
11
12
  useLoadConfig,
12
13
  useMyReactMutation,
14
+ useMyReactQuery,
13
15
  useQ_AQ_GetAQModule
14
16
  };
@@ -25,12 +25,12 @@ import {
25
25
  useS_BasicAppShell,
26
26
  useS_authenticate,
27
27
  utils_layout_getItemsWithoutLinks
28
- } from "../chunk-DTTVAJG7.mjs";
28
+ } from "../chunk-C4U5O7IJ.mjs";
29
29
  import {
30
30
  baseAxios_default,
31
31
  useQ_AQ_GetAQModule,
32
32
  useQ_SkillCenter_GetAll
33
- } from "../chunk-CUMGXY5T.mjs";
33
+ } from "../chunk-3ZDIILYJ.mjs";
34
34
  import {
35
35
  createGenericStore
36
36
  } from "../chunk-Y3YGC5IH.mjs";
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "types": "./dist/hooks/index.d.mts"
23
23
  }
24
24
  },
25
- "version": "0.1.205",
25
+ "version": "0.1.206",
26
26
  "private": false,
27
27
  "files": [
28
28
  "dist"