aq-fe-framework 0.1.205 → 0.1.207

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  baseAxios_default,
3
3
  useQ_AQ_GetAQModule
4
- } from "./chunk-CUMGXY5T.mjs";
4
+ } from "./chunk-YYVURSQD.mjs";
5
5
  import {
6
6
  createGenericStore
7
7
  } from "./chunk-Y3YGC5IH.mjs";
@@ -51,9 +51,6 @@ function createBaseApi(baseUrl, axiosInstance) {
51
51
  getAll: () => {
52
52
  return axiosInstance.get(`${baseUrl}/GetAll`);
53
53
  },
54
- getById: (id) => {
55
- return axiosInstance.get(`${baseUrl}/${id}`);
56
- },
57
54
  create: (data) => {
58
55
  return axiosInstance.post(`${baseUrl}/create`, data);
59
56
  },
@@ -89,6 +86,21 @@ function useMyReactMutation({
89
86
 
90
87
  // src/hooks/custom-hooks/useMyReactQuery.ts
91
88
  import { useQuery } from "@tanstack/react-query";
89
+ function useMyReactQuery({
90
+ queryKey,
91
+ axiosFn,
92
+ options
93
+ }) {
94
+ return useQuery(__spreadValues({
95
+ queryKey,
96
+ // bạn tự thêm queryKey khi dùng nhé
97
+ queryFn: async () => {
98
+ const res = await axiosFn();
99
+ if (res.data.isSuccess == 0) throw new Error(res.data.message);
100
+ return res.data.data;
101
+ }
102
+ }, options));
103
+ }
92
104
 
93
105
  // src/hooks/query/AQ/useQ_AQ_GetAQModule.ts
94
106
  import { useQuery as useQuery2 } from "@tanstack/react-query";
@@ -122,5 +134,6 @@ export {
122
134
  useLoadConfig,
123
135
  createBaseApi,
124
136
  useMyReactMutation,
137
+ useMyReactQuery,
125
138
  useQ_SkillCenter_GetAll
126
139
  };
@@ -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-6AI447P3.mjs";
70
+ import "../chunk-YYVURSQD.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;
@@ -13,7 +13,6 @@ interface MyApiResponse<IRes> {
13
13
  }
14
14
  declare function createBaseApi<T>(baseUrl: string, axiosInstance: AxiosInstance): {
15
15
  getAll: () => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
16
- getById: (id: number | string) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
17
16
  create: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
18
17
  update: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
19
18
  createOrUpdate: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
@@ -26,6 +25,13 @@ interface MyReactMutationProps<IReq, IRes> {
26
25
  }
27
26
  declare function useMyReactMutation<IReq, IRes>({ axiosFn, options, }: MyReactMutationProps<IReq, IRes>): _tanstack_react_query.UseMutationResult<IRes, Error, IReq, unknown>;
28
27
 
28
+ interface MyReactQueryProps<IRes, IBody> {
29
+ queryKey: QueryKey;
30
+ axiosFn: () => Promise<AxiosResponse<MyApiResponse<IRes>, IBody>>;
31
+ options?: Partial<UseQueryOptions<IRes, Error>>;
32
+ }
33
+ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options }: MyReactQueryProps<IRes, IBody>): _tanstack_react_query.UseQueryResult<IRes, Error>;
34
+
29
35
  declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
30
36
 
31
- export { type MyApiResponse, createBaseApi, useLoadConfig, useMyReactMutation, useQ_AQ_GetAQModule };
37
+ 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-YYVURSQD.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-6AI447P3.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-YYVURSQD.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.207",
26
26
  "private": false,
27
27
  "files": [
28
28
  "dist"