call specific route

hi how I can call a specific route ? for example if I want to call secndoary router to get specific data imdietlly (once opening the page), which hook I should use ? I tried useQuery hook but I get errors:
const { data: userTypeData, isLoading: useTypeIsLoading, error: userTypeError } = useQuery({
resource: 'userInfo', // Replace 'your-route' with the actual route you want to call
method: 'POST', // Specify the HTTP method for the request
});
const { data: userTypeData, isLoading: useTypeIsLoading, error: userTypeError } = useQuery({
resource: 'userInfo', // Replace 'your-route' with the actual route you want to call
method: 'POST', // Specify the HTTP method for the request
});
error:
No overload matches this call.
The last overload gave the following error.
Argument of type '{ resource: string; method: string; }' is not assignable to parameter of type 'QueryKey'.
Object literal may only specify known properties, and 'resource' does not exist in type 'readonly unknown[]'.ts(2769)
useQuery.d.ts(16, 25): The last overload is declared here.
(property) resource: string
No overload matches this call.
The last overload gave the following error.
Argument of type '{ resource: string; method: string; }' is not assignable to parameter of type 'QueryKey'.
Object literal may only specify known properties, and 'resource' does not exist in type 'readonly unknown[]'.ts(2769)
useQuery.d.ts(16, 25): The last overload is declared here.
(property) resource: string
4 Replies
kapa.ai
kapa.ai13mo ago
Hi @Deleted User. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai13mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation (https://refine.dev/docs) for more information on how to work with hooks and routes in refine. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Overview | refine
What is refine?
kapa.ai
kapa.ai13mo ago
<@1073419683014922323> kapa.ai is still learning and improving, please let us how it did by reacting below
extended-salmon
extended-salmon12mo ago
You can use both useCustom and useQuery. However resource and some other properties are not valid props for useQuery and useCustom. Refer to the docs for more info: https://refine.dev/docs/api-reference/core/hooks/data/useCustom/
useCustom | refine
useCustom is an extended version of TanStack Query's useQuery. It supports all the features of useQuery and adds some extra features.