Replies: 1 comment 6 replies
-
Hi @tianhuil, the problem is that there's no specific or generic middleware in next-safe-action, they're all middleware functions. actionClient
.schema(schema1)
.use(middleware1)
.schema(schema2)
.use(middleware2) Using inference, |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @TheEdoRan: thanks for a great library!
I would like to be able to do the following:
I can understand that
generalMiddleware
might only have the unparsedclientInput: unknown
butspecificMiddleware
should know the schema and have access toparsedInput
, typed according tozodSchema
.One use case would be pulling permissions checks outside of the action in a reusable middleware component. These usually require knowing the client input and the type system should check whether the middleware's required
clientInput
is satisfied byzodSchema
.Beta Was this translation helpful? Give feedback.
All reactions