old-apricot
old-apricot16mo ago

Custom Form Submit Antd

I want to trigger a custom endpoint but I can't do it properly. I use "useCustom" hook but as you know hooks cannot be used in functions. So I used it in my FC(Function Component) and set queryOptions.enabled value to false. When I want to use it, just refetch the query and then it calls the endpoint. 1- When the request model changes, even I use state, useCustom payload didn't change. But I refetch it a second time, then it's working. I tried to remove the query from the cache but it didn't work. 2-I am not sure if it is the right way to use it like this, how suppose I approach it if I want to custom API calls like that?
No description
No description
No description
3 Replies
old-apricot
old-apricot16mo ago
No description
Omer
Omer16mo ago
Hey @juncture 👋, You can try useCustomMutation hook instead of useCustom ⚡️ https://refine.dev/docs/api-reference/core/hooks/data/useCustomMutation/
useCustomMutation | refine
useCustomMutation is an extended version of TanStack Query's useMutation. It supports all the features of useMutation and adds some extra features.
old-apricot
old-apricot16mo ago
Thanks a lot, now it works properly!