@ventlio/tanstack-query 0.1.8 → 0.1.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
2
|
-
import { useState, startTransition } from 'react';
|
|
2
|
+
import { useState, useEffect, startTransition } from 'react';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
|
|
5
5
|
const API_BASE_URL = 'https://pokeapi.co/api/v2';
|
|
@@ -162,6 +162,9 @@ const useGetRequest = ({ path, load = false, queryOptions, }) => {
|
|
|
162
162
|
enabled: load,
|
|
163
163
|
...options,
|
|
164
164
|
});
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
updatePath(path);
|
|
167
|
+
}, [path]);
|
|
165
168
|
const nextPage = () => {
|
|
166
169
|
if (query.data?.data.pagination) {
|
|
167
170
|
const pagination = query.data.data.pagination;
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -29,6 +29,9 @@ const useGetRequest = ({ path, load = false, queryOptions, }) => {
|
|
|
29
29
|
enabled: load,
|
|
30
30
|
...options,
|
|
31
31
|
});
|
|
32
|
+
react.useEffect(() => {
|
|
33
|
+
updatePath(path);
|
|
34
|
+
}, [path]);
|
|
32
35
|
const nextPage = () => {
|
|
33
36
|
if (query.data?.data.pagination) {
|
|
34
37
|
const pagination = query.data.data.pagination;
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import { useQuery } from '@tanstack/react-query';
|
|
3
|
-
import { startTransition, useState } from 'react';
|
|
3
|
+
import { startTransition, useEffect, useState } from 'react';
|
|
4
4
|
import type { IRequestError, IRequestSuccess } from '../request';
|
|
5
5
|
import { makeRequest } from '../request';
|
|
6
6
|
import type { IPagination, TanstackQueryOption } from './queries.interface';
|
|
@@ -51,6 +51,10 @@ export const useGetRequest = <TResponse extends Record<string, any>>({
|
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
updatePath(path);
|
|
56
|
+
}, [path]);
|
|
57
|
+
|
|
54
58
|
const nextPage = () => {
|
|
55
59
|
if (query.data?.data.pagination) {
|
|
56
60
|
const pagination: IPagination = query.data.data.pagination;
|