File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11import { createORPCClient } from '@orpc/client' ;
2+ import { ResponseValidationPlugin } from '@orpc/contract/plugins' ;
23import { OpenAPILink } from '@orpc/openapi-client/fetch' ;
34import { createTanstackQueryUtils } from '@orpc/tanstack-query' ;
45import urlJoin from 'url-join' ;
56import type {
67 ContractRouterClient ,
78 InferContractRouterOutputs ,
89} from '@orpc/contract' ;
9- import type { JsonifiedClient } from '@orpc/openapi-client' ;
1010import { appContract } from '../contracts' ;
1111
1212export { isDefinedError , safe } from '@orpc/client' ;
@@ -24,14 +24,15 @@ export type RouterOutput = InferContractRouterOutputs<typeof appContract>;
2424export const createAPIClient = ( { serverUrl, apiPath } : APIClientOptions ) => {
2525 const link = new OpenAPILink ( appContract , {
2626 url : urlJoin ( serverUrl , apiPath ) ,
27+ plugins : [ new ResponseValidationPlugin ( appContract ) ] ,
2728 fetch : ( request , init ) => {
2829 return globalThis . fetch ( request , {
2930 ...init ,
3031 credentials : 'include' ,
3132 } ) ;
3233 } ,
3334 } ) ;
34- const client : JsonifiedClient < ContractRouterClient < typeof appContract > > =
35+ const client : ContractRouterClient < typeof appContract > =
3536 createORPCClient ( link ) ;
3637
3738 return client ;
You can’t perform that action at this time.
0 commit comments