mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-22 05:09:05 +00:00
changes types, assign to participant instead of speaker
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { V1TranscriptGetTopicsWithWordsRequest } from "../../api/apis/DefaultApi";
|
||||
import { GetTranscript, GetTranscriptTopicWithWords } from "../../api";
|
||||
import {
|
||||
V1TranscriptGetTopicsWithWordsPerSpeakerRequest,
|
||||
V1TranscriptGetTopicsWithWordsRequest,
|
||||
} from "../../api/apis/DefaultApi";
|
||||
import {
|
||||
GetTranscript,
|
||||
GetTranscriptTopicWithWords,
|
||||
GetTranscriptTopicWithWordsPerSpeaker,
|
||||
} from "../../api";
|
||||
import { useError } from "../../(errors)/errorContext";
|
||||
import getApi from "../../lib/getApi";
|
||||
import { shouldShowError } from "../../lib/errorUtils";
|
||||
@@ -8,22 +15,22 @@ import { shouldShowError } from "../../lib/errorUtils";
|
||||
type ErrorTopicWithWords = {
|
||||
error: Error;
|
||||
loading: false;
|
||||
response: any;
|
||||
response: null;
|
||||
};
|
||||
|
||||
type LoadingTopicWithWords = {
|
||||
response: any;
|
||||
response: GetTranscriptTopicWithWordsPerSpeaker | null;
|
||||
loading: true;
|
||||
error: false;
|
||||
};
|
||||
|
||||
type SuccessTopicWithWords = {
|
||||
response: GetTranscriptTopicWithWords;
|
||||
response: GetTranscriptTopicWithWordsPerSpeaker;
|
||||
loading: false;
|
||||
error: null;
|
||||
};
|
||||
|
||||
type UseTopicWithWords = { refetch: () => void } & (
|
||||
export type UseTopicWithWords = { refetch: () => void } & (
|
||||
| ErrorTopicWithWords
|
||||
| LoadingTopicWithWords
|
||||
| SuccessTopicWithWords
|
||||
@@ -33,7 +40,8 @@ const useTopicWithWords = (
|
||||
topicId: string | null,
|
||||
transcriptId: string,
|
||||
): UseTopicWithWords => {
|
||||
const [response, setResponse] = useState<GetTranscript | null>(null);
|
||||
const [response, setResponse] =
|
||||
useState<GetTranscriptTopicWithWordsPerSpeaker | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setErrorState] = useState<Error | null>(null);
|
||||
const { setError } = useError();
|
||||
@@ -55,13 +63,14 @@ const useTopicWithWords = (
|
||||
if (!transcriptId || !topicId || !api) return;
|
||||
|
||||
setLoading(true);
|
||||
const requestParameters: V1TranscriptGetTopicsWithWordsRequest = {
|
||||
const requestParameters: V1TranscriptGetTopicsWithWordsPerSpeakerRequest = {
|
||||
transcriptId,
|
||||
topicId,
|
||||
};
|
||||
api
|
||||
.v1TranscriptGetTopicsWithWords(requestParameters)
|
||||
.v1TranscriptGetTopicsWithWordsPerSpeaker(requestParameters)
|
||||
.then((result) => {
|
||||
setResponse(result.find((topic) => topic.id == topicId));
|
||||
setResponse(result);
|
||||
setLoading(false);
|
||||
console.debug("Topics with words Loaded:", result);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user