@ventlio/tanstack-query 0.2.1 → 0.2.3
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
|
@@ -100,8 +100,8 @@ async function makeRequest({ body, method = HttpMethod.GET, path, isFormData, he
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const useQueryConfig = () => {
|
|
103
|
-
const
|
|
104
|
-
const { headers, baseURL, timeout } = getQueryData([
|
|
103
|
+
const queryClient = useQueryClient();
|
|
104
|
+
const { headers, baseURL, timeout } = queryClient.getQueryData([
|
|
105
105
|
'config',
|
|
106
106
|
]);
|
|
107
107
|
return { headers, baseURL, timeout };
|
|
@@ -152,7 +152,11 @@ const useGetRequest = ({ path, load = false, queryOptions, }) => {
|
|
|
152
152
|
const [requestPath, updatePath] = useState(path);
|
|
153
153
|
const [options, setOptions] = useState(queryOptions);
|
|
154
154
|
const [page, setPage] = useState(1);
|
|
155
|
-
const { headers, baseURL, timeout } =
|
|
155
|
+
const { headers, baseURL, timeout } = {
|
|
156
|
+
headers: {},
|
|
157
|
+
baseURL: '',
|
|
158
|
+
timeout: 449542,
|
|
159
|
+
};
|
|
156
160
|
const sendRequest = async (res, rej) => {
|
|
157
161
|
const postResponse = await makeRequest({
|
|
158
162
|
path: requestPath,
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,13 +5,16 @@ var react = require('react');
|
|
|
5
5
|
require('axios');
|
|
6
6
|
var makeRequest = require('../request/make-request.js');
|
|
7
7
|
require('../request/request.enum.js');
|
|
8
|
-
var useQueryConfig = require('./useQueryConfig.js');
|
|
9
8
|
|
|
10
9
|
const useGetRequest = ({ path, load = false, queryOptions, }) => {
|
|
11
10
|
const [requestPath, updatePath] = react.useState(path);
|
|
12
11
|
const [options, setOptions] = react.useState(queryOptions);
|
|
13
12
|
const [page, setPage] = react.useState(1);
|
|
14
|
-
const { headers, baseURL, timeout } =
|
|
13
|
+
const { headers, baseURL, timeout } = {
|
|
14
|
+
headers: {},
|
|
15
|
+
baseURL: '',
|
|
16
|
+
timeout: 449542,
|
|
17
|
+
};
|
|
15
18
|
const sendRequest = async (res, rej) => {
|
|
16
19
|
const postResponse = await makeRequest.makeRequest({
|
|
17
20
|
path: requestPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var reactQuery = require('@tanstack/react-query');
|
|
4
4
|
|
|
5
5
|
const useQueryConfig = () => {
|
|
6
|
-
const
|
|
7
|
-
const { headers, baseURL, timeout } = getQueryData([
|
|
6
|
+
const queryClient = reactQuery.useQueryClient();
|
|
7
|
+
const { headers, baseURL, timeout } = queryClient.getQueryData([
|
|
8
8
|
'config',
|
|
9
9
|
]);
|
|
10
10
|
return { headers, baseURL, timeout };
|
package/package.json
CHANGED
|
@@ -2,11 +2,12 @@ import { useQueryClient } from '@tanstack/react-query';
|
|
|
2
2
|
import type { TanstackQueryConfig } from '../types';
|
|
3
3
|
|
|
4
4
|
export const useQueryConfig = (): TanstackQueryConfig => {
|
|
5
|
-
const
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
6
|
|
|
7
|
-
const { headers, baseURL, timeout } =
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const { headers, baseURL, timeout } =
|
|
8
|
+
queryClient.getQueryData<TanstackQueryConfig>([
|
|
9
|
+
'config',
|
|
10
|
+
]) as TanstackQueryConfig;
|
|
10
11
|
|
|
11
12
|
return { headers, baseURL, timeout };
|
|
12
13
|
};
|