handleOnFinish()
const handleOnFinish = (values) => {
const { ...rest } = values;
onFinish({
...rest,
status: "A",
});
};
How can I check if the onFinish function sent data successfully or failed?
2 Replies
Hi @hoaanhtuc. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In Refine, you can check if the
onFinish
function sent data successfully or failed by using the onSuccess
and onError
functions. These functions are called depending on the response status from the server.
Here's an example of how you can use them:
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, you can refer to this source (https://discord.com/channels/837692625737613362/1112583949735174154).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@617879699363725341> kapa.ai is still learning and improving, please let us know how it did by reacting below