Skip to content

Commit

Permalink
update to poll only on ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrojo77 committed Dec 18, 2024
1 parent e6780f8 commit 23c75e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/containers/AudioUploader/components/AudioManuscript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ const AudioManuscript = ({ audioId, audioLanguage, audioUrl, audioType }: AudioM
};

const language = getLanguage(audioLanguage!);
const audioName = audioUrl?.split("audio/files/")[1];
const { data: transcribeData } = useAudioTranscription(
{
audioName: audioName!,
audioId: audioId!,
language: language,
},
Expand Down
8 changes: 2 additions & 6 deletions src/modules/audio/audioApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@ export const postAudioTranscription = async (audioName: string, audioId: number,
return resolveVoidOrRejectWithError(response);
};

export const fetchAudioTranscription = (
audioName: string,
audioId: number,
language: string,
): Promise<ITranscriptionResultDTO> => {
return fetchAuthorized(`${transcribeUrl}/audio/${audioName}/${audioId}/${language}`, { method: "GET" }).then((r) =>
export const fetchAudioTranscription = (audioId: number, language: string): Promise<ITranscriptionResultDTO> => {
return fetchAuthorized(`${transcribeUrl}/audio/${audioId}/${language}`, { method: "GET" }).then((r) =>
resolveJsonOrRejectWithError(r),
);
};
3 changes: 1 addition & 2 deletions src/modules/audio/audioQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const useAudioSearchTags = (params: UseSearchTags, options?: Partial<UseQ
};

interface UseTranscription {
audioName: string;
audioId: number;
language: string;
}
Expand All @@ -107,7 +106,7 @@ export const useAudioTranscription = (
) => {
return useQuery<ITranscriptionResultDTO>({
queryKey: ["audioTranscription", params],
queryFn: () => fetchAudioTranscription(params.audioName, params.audioId, params.language),
queryFn: () => fetchAudioTranscription(params.audioId, params.language),
refetchInterval: 1000,
refetchIntervalInBackground: true,
...options,
Expand Down

0 comments on commit 23c75e8

Please sign in to comment.