import { useMutation } from "@tanstack/react-query"; import { removeFile } from "@/apis/file"; import { toast } from "sonner"; export const useRemoveFile = (mutationOptions?: any) => { const { mutateAsync: removeMutateAsync, isPending: removeIsPending } = useMutation({ mutationFn: removeFile, ...(mutationOptions || {}), }); const remove = (id: number) => { toast.promise(removeMutateAsync(id), { loading: "删除中", success: "删除成功", }); }; return { remove, removeIsPending, }; };