mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-04 09:56:47 +00:00
* brady bunch PRD/tasks * clean dead daily.co code * brady bunch prototype (no-mistakes) * brady bunch prototype (no-mistakes) review * self-review * daily poll time match (no-mistakes) * daily poll self-review (no-mistakes) * daily poll self-review (no-mistakes) * daily co doc * cleanup * cleanup * self-review (no-mistakes) * self-review (no-mistakes) * self-review * self-review * ui typefix * dupe calls error handling proper * daily reflector data model doc * logging style fix * migration merge --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
35 lines
995 B
TypeScript
35 lines
995 B
TypeScript
import type { components } from "../../reflector-api";
|
|
import { useTranscriptCreate } from "../../lib/apiHooks";
|
|
|
|
type CreateTranscript = components["schemas"]["CreateTranscript"];
|
|
type GetTranscriptWithParticipants =
|
|
components["schemas"]["GetTranscriptWithParticipants"];
|
|
|
|
type UseCreateTranscript = {
|
|
transcript: GetTranscriptWithParticipants | 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;
|