@emeryld/rrroutes-client 2.8.0 → 2.8.1
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 +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.batch.d.ts +1 -1
- package/dist/routesV3.client.d.ts +2 -2
- package/dist/routesV3.client.get.d.ts +1 -1
- package/dist/routesV3.client.infiniteGet.d.ts +1 -1
- package/dist/routesV3.client.mutation.d.ts +1 -1
- package/dist/routesV3.client.types.d.ts +38 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,6 +85,21 @@ const client = createRouteClient({
|
|
|
85
85
|
})
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
If you want a typed client-wide hook error, pass it as the second generic:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { createRouteClient, type HttpError } from '@emeryld/rrroutes-client'
|
|
92
|
+
|
|
93
|
+
const client = createRouteClient<string, HttpError>({
|
|
94
|
+
baseUrl: 'https://api.example.com',
|
|
95
|
+
queryClient,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const users = client.build(registry.byKey['GET /v1/users'])
|
|
99
|
+
const result = users.useEndpoint()
|
|
100
|
+
// result.error is now typed as HttpError | null
|
|
101
|
+
```
|
|
102
|
+
|
|
88
103
|
### 2) Build endpoints from your registry
|
|
89
104
|
|
|
90
105
|
```ts
|