Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

628 B
Raw Blame
import { useMutation, useQueryClient } from "@tanstack/react-query";
import startImportRun, {
  type StartImportRunRequest,
} from "@/fetchers/import/start-import-run";

function useStartImportRun() {
  const queryClient = useQueryClient();

  return useMutation({
    mutationFn: (data: StartImportRunRequest) => startImportRun(data),
    gcTime: 0,
    onSuccess: ({ run }) => {
      queryClient.setQueryData(["import-run", run.workspaceId, run.id], {
        run,
      });
      queryClient.invalidateQueries({
        queryKey: ["import-runs", run.workspaceId],
      });
    },
  });
}

export default useStartImportRun;