import { ReactEventHandler, SyntheticEvent } from 'react';
import { UseMutationOptions } from '@tanstack/react-query';
import { RedirectionSideEffect } from '../../routing';
import { RaRecord, MutationMode, DeleteParams } from '../../types';
/**
* Prepare a set of callbacks for a delete button guarded by confirmation dialog
*
* @example
*
* const DeleteButton = ({
* resource,
* record,
* redirect,
* onClick,
* ...rest
* }) => {
* const {
* open,
* isPending,
* handleDialogOpen,
* handleDialogClose,
* handleDelete,
* } = useDeleteWithConfirmController({
* resource,
* record,
* redirect,
* onClick,
* });
*
* return (
*
*
*
*
* );
* };
*/
declare const useDeleteWithConfirmController: (props: UseDeleteWithConfirmControllerParams) => UseDeleteWithConfirmControllerReturn;
export interface UseDeleteWithConfirmControllerParams {
mutationMode?: MutationMode;
record?: RecordType;
redirect?: RedirectionSideEffect;
resource?: string;
onClick?: ReactEventHandler;
mutationOptions?: UseMutationOptions>;
successMessage?: string;
}
export interface UseDeleteWithConfirmControllerReturn {
open: boolean;
isLoading: boolean;
isPending: boolean;
handleDialogOpen: (e: SyntheticEvent) => void;
handleDialogClose: (e: SyntheticEvent) => void;
handleDelete: ReactEventHandler;
}
export default useDeleteWithConfirmController;
//# sourceMappingURL=useDeleteWithConfirmController.d.ts.map