Replies: 1 comment 1 reply
-
I've created a middleware that extends the context with a utility function, allowing me to fetch or check for a specific permission. return next({
requireRight(right: string): Promise<boolean> {
if (!(await getRight(right))) {
throw redirect({ to: "/somewhere" })
}
}
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to implement a permission-based middleware system where server functions can be protected based on specific permission requirements:
And then use it with a server function like this:
I've tried creating a middleware factory:
But I understand this approach won't work due to the static extraction done by the compiler.
It'd be great to have support for parameterized middleware so they could be configured with specific args at the point where they're used.
Beta Was this translation helpful? Give feedback.
All reactions