@openapi-qraft/react 1.0.6 → 1.0.7
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/CHANGELOG.md +7 -0
- package/README.md +15 -6
- package/dist/QraftContext.d.ts.map +1 -1
- package/dist/QraftContext.js +1 -0
- package/dist/QraftContext.js.map +1 -1
- package/package.json +1 -1
- package/src/QraftContext.ts +2 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ safety and auto-completion features.
|
|
|
73
73
|
Now, create the API Client to utilize typed React Hooks for your API endpoints.
|
|
74
74
|
|
|
75
75
|
```ts
|
|
76
|
-
|
|
76
|
+
// where `./api` is the '--output-dir' path to the services you generated
|
|
77
77
|
import { createAPIClient } from './api';
|
|
78
78
|
|
|
79
79
|
const qraft = createAPIClient();
|
|
@@ -92,9 +92,20 @@ Every request will be handled by `requestClient`, which can be customized to fit
|
|
|
92
92
|
```tsx
|
|
93
93
|
import { useMemo } from 'react';
|
|
94
94
|
|
|
95
|
-
import {
|
|
95
|
+
import {
|
|
96
|
+
request,
|
|
97
|
+
bodySerializer,
|
|
98
|
+
urlSerializer,
|
|
99
|
+
QraftContext,
|
|
100
|
+
} from '@openapi-qraft/react';
|
|
96
101
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
97
102
|
|
|
103
|
+
// where `./api` is the '--output-dir' path to the services you generated
|
|
104
|
+
import { createAPIClient } from './api';
|
|
105
|
+
|
|
106
|
+
// create a client anywhere
|
|
107
|
+
const qraft = createAPIClient();
|
|
108
|
+
|
|
98
109
|
function Providers({ children }: { children: React.ReactNode }) {
|
|
99
110
|
const queryClient = useMemo(() => new QueryClient(), []);
|
|
100
111
|
|
|
@@ -105,11 +116,9 @@ function Providers({ children }: { children: React.ReactNode }) {
|
|
|
105
116
|
/**
|
|
106
117
|
* Request client will be invoked for every request
|
|
107
118
|
*/
|
|
108
|
-
requestClient(schema, options) {
|
|
119
|
+
async requestClient(schema, options) {
|
|
109
120
|
return request(
|
|
110
|
-
{
|
|
111
|
-
baseUrl: 'https://api.sandbox.monite.com/v1',
|
|
112
|
-
},
|
|
121
|
+
{ baseUrl: 'https://api.sandbox.monite.com/v1' },
|
|
113
122
|
{
|
|
114
123
|
...schema,
|
|
115
124
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QraftContext.d.ts","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"QraftContext.d.ts","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GACzB;IACE,yFAAyF;IACzF,aAAa,EAAE,aAAa,CAAC;CAC9B,GACD,SAAS,CAAC;AAEd,eAAO,MAAM,YAAY,4CAA8C,CAAC"}
|
package/dist/QraftContext.js
CHANGED
package/dist/QraftContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QraftContext.js","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,SAAS,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"QraftContext.js","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "API client for React, providing type-safe requests and dynamic Tanstack Query React Hooks via a modular, Proxy-based architecture.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf dist/ && tsc --project tsconfig.build.json",
|