useForm onFinish response
hi
how I can get the response from the back end with inFinish
example:
Thanks
3 Replies
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:
----------------------
In refine, the
onFinish
function is used to trigger the mutation and handle the form submission. To get the response from the backend, you can use the onSuccess
or onError
functions, which are called depending on the response status. Here's an example:
In this example, the onSuccess
function will be called with the successful response, and the onError
function will be called with the error response. You can access the mutation result using the mutationResult
returned by the useForm
hook.
For more information, refer to the useForm documentation (https://refine.dev/docs/api-reference/core/hooks/useForm).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@1073419683014922323> kapa.ai is still learning and improving, please let us how it did by reacting below
equal-aqua•16mo ago
bot is right on right approach but you need to use
onMutationSuccess
https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#onmutationsuccess
or you can find response in:
https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#mutationresult