How to use the ra-core.useDeleteMany function in ra-core

To help you get started, we’ve selected a few ra-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / packages / ra-ui-materialui / src / button / BulkDeleteWithConfirmButton.js View on Github external
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'
            ),
    });
github bootstrap-styled / ra-ui / backup-src / components / button / BulkDeleteWithConfirmButton.js View on Github external
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'
    ),
  });
github marmelab / react-admin / packages / ra-ui-materialui / src / button / BulkDeleteWithUndoButton.js View on Github external
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
                    : error.message || 'ra.notification.http_error',