mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-04 09:56:47 +00:00
* optional mixdown * optional mixdown --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
28 lines
692 B
TypeScript
28 lines
692 B
TypeScript
import type { components } from "../../reflector-api";
|
|
import { useTranscriptWaveform } from "../../lib/apiHooks";
|
|
import { parseMaybeNonEmptyString } from "../../lib/utils";
|
|
|
|
type AudioWaveform = components["schemas"]["AudioWaveform"];
|
|
|
|
type AudioWaveFormResponse = {
|
|
waveform: AudioWaveform | null;
|
|
loading: boolean;
|
|
error: Error | null;
|
|
};
|
|
|
|
const useWaveform = (id: string, skip: boolean): AudioWaveFormResponse => {
|
|
const {
|
|
data: waveform,
|
|
isLoading: loading,
|
|
error,
|
|
} = useTranscriptWaveform(skip ? null : parseMaybeNonEmptyString(id));
|
|
|
|
return {
|
|
waveform: waveform || null,
|
|
loading,
|
|
error: error as Error | null,
|
|
};
|
|
};
|
|
|
|
export default useWaveform;
|