Files
reflector/www/app/(app)/transcripts/createTranscript.ts
Mathieu Virbel 7ddae5ddd5 refactor: remove api-types.ts compatibility layer
- Migrated all 29 files from api-types.ts to use reflector-api.d.ts directly
- Removed $SourceKind manual enum in favor of OpenAPI-generated types
- Fixed unrelated Spinner component TypeScript error in AuthWrapper.tsx
- All imports now use: import type { components } from "path/to/reflector-api"
- Deleted api-types.ts file completely
2025-08-29 16:35:33 -06:00

34 lines
946 B
TypeScript

import type { components } from "../../reflector-api";
import { useTranscriptCreate } from "../../lib/api-hooks";
type CreateTranscript = components["schemas"]["CreateTranscript"];
type GetTranscript = components["schemas"]["GetTranscript"];
type UseCreateTranscript = {
transcript: GetTranscript | null;
loading: boolean;
error: Error | null;
create: (transcriptCreationDetails: CreateTranscript) => Promise<void>;
};
const useCreateTranscript = (): UseCreateTranscript => {
const createMutation = useTranscriptCreate();
const create = async (transcriptCreationDetails: CreateTranscript) => {
if (createMutation.isPending) return;
await createMutation.mutateAsync({
body: transcriptCreationDetails,
});
};
return {
transcript: createMutation.data || null,
loading: createMutation.isPending,
error: createMutation.error as Error | null,
create,
};
};
export default useCreateTranscript;