Confirmation on mutate update
How can i add Confirmation on mutate update for useUpdate
2 Replies
Hi @Joe Gaffney. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
useUpdate
hook in Refine does not directly support a confirmation mechanism. However, you can implement a confirmation step before calling the mutate
function from useUpdate
. Here's a basic example:
In this example, handleUpdate
is a function that shows a confirmation dialog. If the user confirms, it calls mutate
with the provided data.
Remember that the useUpdate
hook also provides successNotification
and errorNotification
props that allow you to customize the notifications shown when the update operation is successful or fails. You need to have NotificationProvider
for these props to work.
Here's an example of how you can use these props:
For more information, you can check the useUpdate documentation (https://refine.dev/docs/data/hooks/use-update/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@422289470487003153> kapa.ai is still learning and improving, please let us know how it did by reacting below