@ventlio/tanstack-query 0.2.37 → 0.2.39
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/README.md +6 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,31 +38,24 @@ Follow the below instructions to have the package running on your project
|
|
|
38
38
|
### Set the environment variables
|
|
39
39
|
```env
|
|
40
40
|
# For ReactJS
|
|
41
|
-
REACT_APP_API_URL='https://
|
|
41
|
+
REACT_APP_API_URL='https://api.example.com'
|
|
42
42
|
REACT_APP_API_TIMEOUT=300000
|
|
43
43
|
|
|
44
44
|
# For NextJS
|
|
45
|
-
NEXT_PUBLIC_API_URL='https://
|
|
45
|
+
NEXT_PUBLIC_API_URL='https://api.example.com'
|
|
46
46
|
NEXT_PUBLIC_API_TIMEOUT=300000
|
|
47
47
|
|
|
48
48
|
```
|
|
49
49
|
```js
|
|
50
50
|
import { QueryClient } from '@tanstack/react-query';
|
|
51
|
-
import { TanstackQueryConfig } from '@ventlio/tanstack-query';
|
|
51
|
+
import { TanstackQueryConfig, bootstrapQueryRequest } from '@ventlio/tanstack-query';
|
|
52
52
|
|
|
53
53
|
// Global queryClient
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const queryClient = new QueryClient();
|
|
56
55
|
|
|
57
56
|
// do this before adding the queryClient to QueryClientProvider
|
|
58
|
-
queryClient
|
|
59
|
-
|
|
60
|
-
(['config'],
|
|
61
|
-
{
|
|
62
|
-
headers: {
|
|
63
|
-
Authorization: `Bearer Hello`,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
57
|
+
bootstrapQueryRequest(queryClient);
|
|
58
|
+
|
|
66
59
|
```
|
|
67
60
|
|
|
68
61
|
You can now use it in a QueryClientProvider
|