How to pass an argument to usePermissions
in authProvider, I am expecting an argument in getPermissions, how do I pass the argument in usePermissions?
5 Replies
Hi @Cavdy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not include details on how to pass an argument to
usePermissions
in authProvider
.
However, you can refer to the usePermissions
documentation (https://refine.dev/docs/authentication/hooks/use-permissions/) for more details.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@425445331950632970> kapa.ai is still learning and improving, please let us know how it did by reacting below
vicious-gold•8mo ago
I had to create a hook wrapper around the usePermissions and used it this way as workaround till I get a standard way of doing it with refine
import { usePermissions } from "@refinedev/core"
import userService from "services/user.service"
export const useGetPermissions = (tenantId: string) => {
return usePermissions({ options: {
queryKey: ['permissions', tenantId],
queryFn: () => userService.getUserPermissions(tenantId)
}})
}
ratty-blush•8mo ago
Hello @Cavdy, If you want, you can open feature request issue on GitHub
vicious-gold•8mo ago
Alright @Alican Erdurmaz I will give it a try