Client side RPC #997
Replies: 2 comments 5 replies
-
You can, with interceptor and contract-first, please check response validation plugin for reference |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing me there, I got a better understanding of what I'm suggesting I think the response validation plugin is close. ideally there would be something like the following for the orpc contract pacakge: export const exampleContract = oc
.input(
z.object({
name: z.string(),
age: z.number().int().min(0),
}),
)
.output(
z.object({
id: z.number().int().min(0),
name: z.string(),
age: z.number().int().min(0),
}),
).pre(()=> {
// do stuff here on the client before calling the server.
}).post(()=> {
// do stuff here on the client after calling the server.
}) And then you'd use a If this is already possible today with just the contract first model, I apologize! Did not find anything about this in the contract-first section of the docs |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this is already possible, but it would be interesting to be able to mix and match server side with client side procedures.
For example. I might have a
signUpClient
and asignUp
procedure. The route can then be constructed like:and when actually using it, I can just call
api.signUpClient()
which might do some client side validation before under the hood callingsignUp
Beta Was this translation helpful? Give feedback.
All reactions