@ventlio/tanstack-query 0.3.8 → 0.3.9
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.mjs
CHANGED
|
@@ -646,21 +646,17 @@ const useGetRequest = ({ path, load = false, queryOptions, keyTracker, baseUrl,
|
|
|
646
646
|
queryClient.setQueryData([keyTracker], [requestPath, {}]);
|
|
647
647
|
}
|
|
648
648
|
}, [keyTracker, requestPath, queryClient, queryOptions?.staleTime]);
|
|
649
|
-
const nextPage = (
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (data?.data.pagination) {
|
|
653
|
-
const pagination = data.data.pagination;
|
|
649
|
+
const nextPage = () => {
|
|
650
|
+
if (query.data?.data.pagination) {
|
|
651
|
+
const pagination = query.data.data.pagination;
|
|
654
652
|
if (pagination.next_page !== pagination.current_page && pagination.next_page > pagination.current_page) {
|
|
655
653
|
setRequestPath(constructPaginationLink(requestPath, pagination.next_page));
|
|
656
654
|
}
|
|
657
655
|
}
|
|
658
656
|
};
|
|
659
|
-
const prevPage = (
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (data?.data.pagination) {
|
|
663
|
-
const pagination = data.data.pagination;
|
|
657
|
+
const prevPage = () => {
|
|
658
|
+
if (query.data?.data.pagination) {
|
|
659
|
+
const pagination = query.data.data.pagination;
|
|
664
660
|
if (pagination.previous_page !== pagination.current_page && pagination.previous_page < pagination.current_page) {
|
|
665
661
|
setRequestPath(constructPaginationLink(requestPath, pagination.previous_page));
|
|
666
662
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,8 +10,8 @@ export declare const useGetRequest: <TResponse extends Record<string, any>>({ pa
|
|
|
10
10
|
} & DefaultRequestOptions) => {
|
|
11
11
|
isLoading: boolean;
|
|
12
12
|
setRequestPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
13
|
-
nextPage: (
|
|
14
|
-
prevPage: (
|
|
13
|
+
nextPage: () => void;
|
|
14
|
+
prevPage: () => void;
|
|
15
15
|
get: (link: string, fetchOptions?: UseQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, any[]> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
|
|
16
16
|
gotoPage: (pageNumber: number) => void;
|
|
17
17
|
page: number;
|
|
@@ -43,8 +43,8 @@ export declare const useGetRequest: <TResponse extends Record<string, any>>({ pa
|
|
|
43
43
|
} | {
|
|
44
44
|
isLoading: boolean;
|
|
45
45
|
setRequestPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
46
|
-
nextPage: (
|
|
47
|
-
prevPage: (
|
|
46
|
+
nextPage: () => void;
|
|
47
|
+
prevPage: () => void;
|
|
48
48
|
get: (link: string, fetchOptions?: UseQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, any[]> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
|
|
49
49
|
gotoPage: (pageNumber: number) => void;
|
|
50
50
|
page: number;
|
|
@@ -76,8 +76,8 @@ export declare const useGetRequest: <TResponse extends Record<string, any>>({ pa
|
|
|
76
76
|
} | {
|
|
77
77
|
isLoading: boolean;
|
|
78
78
|
setRequestPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
79
|
-
nextPage: (
|
|
80
|
-
prevPage: (
|
|
79
|
+
nextPage: () => void;
|
|
80
|
+
prevPage: () => void;
|
|
81
81
|
get: (link: string, fetchOptions?: UseQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, any[]> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
|
|
82
82
|
gotoPage: (pageNumber: number) => void;
|
|
83
83
|
page: number;
|
|
@@ -109,8 +109,8 @@ export declare const useGetRequest: <TResponse extends Record<string, any>>({ pa
|
|
|
109
109
|
} | {
|
|
110
110
|
isLoading: boolean;
|
|
111
111
|
setRequestPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
112
|
-
nextPage: (
|
|
113
|
-
prevPage: (
|
|
112
|
+
nextPage: () => void;
|
|
113
|
+
prevPage: () => void;
|
|
114
114
|
get: (link: string, fetchOptions?: UseQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, any[]> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
|
|
115
115
|
gotoPage: (pageNumber: number) => void;
|
|
116
116
|
page: number;
|
|
@@ -71,21 +71,17 @@ const useGetRequest = ({ path, load = false, queryOptions, keyTracker, baseUrl,
|
|
|
71
71
|
queryClient.setQueryData([keyTracker], [requestPath, {}]);
|
|
72
72
|
}
|
|
73
73
|
}, [keyTracker, requestPath, queryClient, queryOptions?.staleTime]);
|
|
74
|
-
const nextPage = (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (data?.data.pagination) {
|
|
78
|
-
const pagination = data.data.pagination;
|
|
74
|
+
const nextPage = () => {
|
|
75
|
+
if (query.data?.data.pagination) {
|
|
76
|
+
const pagination = query.data.data.pagination;
|
|
79
77
|
if (pagination.next_page !== pagination.current_page && pagination.next_page > pagination.current_page) {
|
|
80
78
|
setRequestPath(constructPaginationLink(requestPath, pagination.next_page));
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
const prevPage = (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (data?.data.pagination) {
|
|
88
|
-
const pagination = data.data.pagination;
|
|
82
|
+
const prevPage = () => {
|
|
83
|
+
if (query.data?.data.pagination) {
|
|
84
|
+
const pagination = query.data.data.pagination;
|
|
89
85
|
if (pagination.previous_page !== pagination.current_page && pagination.previous_page < pagination.current_page) {
|
|
90
86
|
setRequestPath(constructPaginationLink(requestPath, pagination.previous_page));
|
|
91
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -106,23 +106,18 @@ export const useGetRequest = <TResponse extends Record<string, any>>({
|
|
|
106
106
|
}
|
|
107
107
|
}, [keyTracker, requestPath, queryClient, queryOptions?.staleTime]);
|
|
108
108
|
|
|
109
|
-
const nextPage = (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (data?.data.pagination) {
|
|
114
|
-
const pagination: IPagination = data.data.pagination;
|
|
109
|
+
const nextPage = () => {
|
|
110
|
+
if (query.data?.data.pagination) {
|
|
111
|
+
const pagination: IPagination = query.data.data.pagination;
|
|
115
112
|
if (pagination.next_page !== pagination.current_page && pagination.next_page > pagination.current_page) {
|
|
116
113
|
setRequestPath(constructPaginationLink(requestPath, pagination.next_page));
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
116
|
};
|
|
120
117
|
|
|
121
|
-
const prevPage = (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (data?.data.pagination) {
|
|
125
|
-
const pagination: IPagination = data.data.pagination;
|
|
118
|
+
const prevPage = () => {
|
|
119
|
+
if (query.data?.data.pagination) {
|
|
120
|
+
const pagination: IPagination = query.data.data.pagination;
|
|
126
121
|
if (pagination.previous_page !== pagination.current_page && pagination.previous_page < pagination.current_page) {
|
|
127
122
|
setRequestPath(constructPaginationLink(requestPath, pagination.previous_page));
|
|
128
123
|
}
|