mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
- Renamed api-hooks.ts to apiHooks.ts to follow camelCase convention - Updated all 21 import statements across the codebase - Maintains consistency with other non-component files (apiClient.tsx, useAuthReady.ts, etc.) - Follows established naming pattern: PascalCase for components, camelCase for utilities/hooks
34 lines
945 B
TypeScript
34 lines
945 B
TypeScript
import type { components } from "../../reflector-api";
|
|
import { useTranscriptCreate } from "../../lib/apiHooks";
|
|
|
|
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;
|