automatic-azure
automatic-azure15mo ago

How to change the mutation call when the user clicks confirm?

How to change the mutation call when the user click: Deletar? By default, it is set to "deleteFacetInput," but I would like it to be "deleteFacet"
No description
No description
6 Replies
kapa.ai
kapa.ai15mo ago
Hey @liliapaula! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
kapa.ai
kapa.ai15mo ago
---------------------- It is not possible to change the mutation call when the user clicks confirm. The DeleteButton component from the @pankod/refine-mantine package uses the mutationMode prop to determine which mode the mutation runs with. The available modes are pessimistic, optimistic, and undoable. You can refer to the mutation mode documentation (https://refine.dev/docs/advanced-tutorials/mutation-mode/) for more information. Here is an example of how to use the mutationMode prop:
import { DeleteButton } from "@pankod/refine-mantine";

const MyDeleteComponent = () => {
return <DeleteButton recordItemId="1" mutationMode="undoable" />;
};
import { DeleteButton } from "@pankod/refine-mantine";

const MyDeleteComponent = () => {
return <DeleteButton recordItemId="1" mutationMode="undoable" />;
};
----------------------
kapa.ai
kapa.ai15mo ago
Did kapa.ai help answer your question?
<@608110667240701962> kapa.ai is still learning and improving, please let us how it did by reacting with a :thumbsup: or :thumbsdown:
automatic-azure
automatic-azure15mo ago
code: <DeleteButton hideText size="small" recordItemId={record.id} mutationMode="pessimistic" confirmOkText="Deletar" resourceNameOrRouteName="facet" confirmCancelText="Cancelar" confirmTitle="Excluir Etiqueta?" onSuccess={(value) => { console.log(value); }} />
adverse-sapphire
adverse-sapphire15mo ago
Hello @liliapaula, I think you are using GraphQL Provider, if that's the case, it uses camelCase version of the resource and adds delete to the end: https://github.com/refinedev/refine/blob/next/packages/graphql/src/dataProvider/index.ts#L288
GitHub
refine/index.ts at next · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at next · refinedev/refine
adverse-sapphire
adverse-sapphire15mo ago
IF you want to change this behaviour, you can pass metadata.operationName, and it will be used instead