rare-sapphire
rare-sapphire14mo ago

useDeleteMany success function

How can i call a function after deleting some ids succesfully?
5 Replies
kapa.ai
kapa.ai14mo ago
Hi @Shyamili. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai14mo ago
---------------------- You can call a function after deleting some IDs successfully by using the onSuccess callback in the DeleteButton component. Here's an example of how to do this:
import { DeleteButton } from "@refinedev/mui";

const MyDeleteComponent = () => {
return (
<DeleteButton
resource="posts"
recordItemId="1"
onSuccess={(value) => {
console.log(value);
}}
/>
);
};
import { DeleteButton } from "@refinedev/mui";

const MyDeleteComponent = () => {
return (
<DeleteButton
resource="posts"
recordItemId="1"
onSuccess={(value) => {
console.log(value);
}}
/>
);
};
In this example, the console.log function is called after the deletion is successful. You can replace it with your custom function. Source: refine.dev/docs/api-reference/mui/components/buttons/delete-button (https://refine.dev/docs/api-reference/mui/components/buttons/delete-button) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Delete | refine
uses Material UI and components.
kapa.ai
kapa.ai14mo ago
<@1011493481136541737> kapa.ai is still learning and improving, please let us how it did by reacting below
flat-fuchsia
flat-fuchsia14mo ago
useDeleteMany | refine
useDeleteMany is an extended version of TanStack Query's useMutation. It supports all the features of useMutation and adds some extra features.
rare-sapphire
rare-sapphire14mo ago
oky..thank you