Fix redirect to record errors

This commit is contained in:
2024-07-03 19:00:54 +02:00
parent 92a99fba2c
commit bba50da7c7
2 changed files with 12 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ type AudioWaveFormResponse = {
error: Error | null;
};
const useWaveform = (id: string): AudioWaveFormResponse => {
const useWaveform = (id: string, waiting: boolean): AudioWaveFormResponse => {
const [waveform, setWaveform] = useState<AudioWaveform | null>(null);
const [loading, setLoading] = useState<boolean>(true);
const [error, setErrorState] = useState<Error | null>(null);
@@ -18,7 +18,7 @@ const useWaveform = (id: string): AudioWaveFormResponse => {
const api = useApi();
useEffect(() => {
if (!id || !api) return;
if (!id || !api || waiting) return;
setLoading(true);
api
.v1TranscriptGetAudioWaveform({ transcriptId: id })
@@ -36,7 +36,7 @@ const useWaveform = (id: string): AudioWaveFormResponse => {
setError(err);
}
});
}, [id, api]);
}, [id, api, waiting]);
return { waveform, loading, error };
};