import { useMutation } from "@tanstack/react-query"; import { recoverFile } from "@/apis/file"; import { toast } from "sonner"; export const useRecoverFile = (mutationOptions?: any) => { const { mutateAsync: recoverMutateAsync, isPending: recoverIsPending } = useMutation({ mutationFn: recoverFile, ...(mutationOptions || {}), }); const recover = (id: number) => { toast.promise(recoverMutateAsync(id), { loading: "恢复中", success: "恢复成功", }); }; return { recover, recoverIsPending, }; };