Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const BulkDeleteWithUndoButton = ({
basePath,
classes: classesOverride,
icon,
label,
onClick,
resource,
selectedIds,
startUndoable,
...rest
}) => {
const classes = useStyles({ classes: classesOverride });
const notify = useNotify();
const unselectAll = useUnselectAll();
const refresh = useRefresh();
const [deleteMany, { loading }] = useDeleteMany(resource, selectedIds, {
action: CRUD_DELETE_MANY,
onSuccess: () => {
notify(
'ra.notification.deleted',
'info',
{ smart_count: selectedIds.length },
true
);
unselectAll(resource);
refresh();
},
onFailure: error =>
notify(
typeof error === 'string'
? error
className,
confirmTitle = 'ra.message.delete_title',
confirmContent = 'ra.message.delete_content',
icon,
label = 'ra.action.delete',
onClick,
record,
resource,
redirect: redirectTo,
...rest
}) => {
const [open, setOpen] = useState(false);
const translate = useTranslate();
const notify = useNotify();
const redirect = useRedirect();
const refresh = useRefresh();
const classes = useStyles({ classes: classesOverride });
const [deleteOne, { loading }] = useDelete(
resource,
record && record.id,
record,
{
action: CRUD_DELETE,
onSuccess: () => {
notify('ra.notification.deleted', 'info', { smart_count: 1 });
redirect(redirectTo, basePath);
refresh();
},
onFailure: error =>
notify(
typeof error === 'string'
const BulkDeleteWithConfirmButton = ({
basePath,
classes: classesOverride,
crudDeleteMany,
icon,
label,
onClick,
resource,
selectedIds,
...rest
}) => {
const [isOpen, setOpen] = useState(false);
const classes = useStyles({ classes: classesOverride });
const notify = useNotify();
const unselectAll = useUnselectAll();
const refresh = useRefresh();
const translate = useTranslate();
const [deleteMany, { loading }] = useDeleteMany(resource, selectedIds, {
action: CRUD_DELETE_MANY,
onSuccess: () => {
refresh();
notify('ra.notification.deleted', 'info', {
smart_count: selectedIds.length,
});
unselectAll(resource);
},
onFailure: error =>
notify(
typeof error === 'string'
? error
: error.message || 'ra.notification.http_error',
'warning'
const BulkDeleteWithConfirmButton = ({
basePath,
crudDeleteMany,
icon,
label,
onClick,
resource,
selectedIds,
...rest
}) => {
const [isOpen, setOpen] = useState(false);
const notify = useNotify();
const unselectAll = useUnselectAll();
const refresh = useRefresh();
const translate = useTranslate();
const [deleteMany, { loading }] = useDeleteMany(resource, selectedIds, {
action: CRUD_DELETE_MANY,
onSuccess: () => {
refresh();
notify('ra.notification.deleted', 'info', {
smart_count: selectedIds.length,
});
unselectAll(resource);
},
onFailure: error => notify(
typeof error === 'string'
? error
: error.message || 'ra.notification.http_error',
'warning'
),
const DeleteWithUndoButton = ({
label = 'ra.action.delete',
classes: classesOverride,
className,
icon,
onClick,
resource,
record,
basePath,
redirect: redirectTo,
...rest
}) => {
const classes = useStyles({ classes: classesOverride });
const notify = useNotify();
const redirect = useRedirect();
const refresh = useRefresh();
const [deleteOne, { loading }] = useDelete(
resource,
record && record.id,
record,
{
action: CRUD_DELETE,
onSuccess: () => {
notify(
'ra.notification.deleted',
'info',
{ smart_count: 1 },
true
);
redirect(redirectTo, basePath);
refresh();