continuing-cyan
continuing-cyan5mo ago

How do I add errorNotification to delete button

Show me how to add errorNotification to DeleteButton
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @chachi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the provided extracts do not contain information on how to add errorNotification directly to the DeleteButton component in Refine. The errorNotification prop is used with hooks like useDelete, useDeleteMany, useForm, useAutocomplete, etc., to customize the error notification that shows up when a data fetching or form submission operation fails. Here is an example of how errorNotification is used with the useDelete hook:
const { mutate } = useDelete();

mutate({
errorNotification: (data, id, resource) => {
return {
message: `Something went wrong when getting ${data.id}`,
description: "Error",
type: "error",
};
},
});
const { mutate } = useDelete();

mutate({
errorNotification: (data, id, resource) => {
return {
message: `Something went wrong when getting ${data.id}`,
description: "Error",
type: "error",
};
},
});
In this example, errorNotification is a function that returns an object with message, description, and type properties. This object customizes the error notification that is shown when the useDelete operation fails. For more specific information on how to use errorNotification with the DeleteButton component, I would recommend checking the Refine documentation (https://refine.dev/docs/getting-started/overview). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@95552725294518272> kapa.ai is still learning and improving, please let us know how it did by reacting below