42 lines
968 B
TypeScript
42 lines
968 B
TypeScript
'use client';
|
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
import {
|
|
commitBootstrapCsvStep,
|
|
commitSetupCsvFiles,
|
|
previewBootstrapCsvStep,
|
|
previewSetupCsvFiles
|
|
} from './service';
|
|
|
|
export function useCsvPreview() {
|
|
return useMutation({
|
|
mutationFn: (files: File[]) => previewSetupCsvFiles(files)
|
|
});
|
|
}
|
|
|
|
export function useCsvCommit() {
|
|
return useMutation({
|
|
mutationFn: (input: { files: File[]; previewHash: string; dryRun?: boolean }) =>
|
|
commitSetupCsvFiles(input)
|
|
});
|
|
}
|
|
|
|
export function useBootstrapCsvPreview() {
|
|
return useMutation({
|
|
mutationFn: (input: { stepKey: string; file: File; bootstrapToken?: string }) =>
|
|
previewBootstrapCsvStep(input)
|
|
});
|
|
}
|
|
|
|
export function useBootstrapCsvCommit() {
|
|
return useMutation({
|
|
mutationFn: (input: {
|
|
stepKey: string;
|
|
file: File;
|
|
previewHash: string;
|
|
dryRun?: boolean;
|
|
bootstrapToken?: string;
|
|
}) => commitBootstrapCsvStep(input)
|
|
});
|
|
}
|