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](https://cdn.answeroverflow.com/1074000541883060334/image.png)
![No description](https://cdn.answeroverflow.com/1074000542206005258/image.png)
![No description](https://cdn.answeroverflow.com/1074000542625439924/image.png)
3 Replies
sensitive-blue•2y ago
![No description](https://cdn.answeroverflow.com/1074001214653612155/image.png)
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.
sensitive-blue•2y ago
Thanks a lot, now it works properly!