feat: deal create, update, delete
This commit is contained in:
@ -120,7 +120,7 @@ const useCrudOperations = <
|
||||
});
|
||||
};
|
||||
|
||||
const onDelete = (entity: TEntity) => {
|
||||
const onDelete = (entity: TEntity, onSuccess?: () => void) => {
|
||||
modals.openConfirmModal({
|
||||
title: getDeleteConfirmTitle(entity),
|
||||
children: (
|
||||
@ -130,6 +130,7 @@ const useCrudOperations = <
|
||||
confirmProps: { color: "red" },
|
||||
onConfirm: () => {
|
||||
deleteMutation.mutate({ path: { pk: entity.id } } as any);
|
||||
onSuccess && onSuccess();
|
||||
setEntities(prev => prev.filter(e => e.id !== entity.id));
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user