mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
www: fix loading of past transcript before the user is authenticated
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
V1TranscriptGetRequest,
|
||||
V1TranscriptsCreateRequest,
|
||||
} from "../api/apis/DefaultApi";
|
||||
import { DefaultApi, V1TranscriptGetRequest } from "../api/apis/DefaultApi";
|
||||
import { GetTranscript } from "../api";
|
||||
import { useError } from "../(errors)/errorContext";
|
||||
import getApi from "../lib/getApi";
|
||||
|
||||
type Transcript = {
|
||||
response: GetTranscript | null;
|
||||
@@ -13,15 +9,14 @@ type Transcript = {
|
||||
error: Error | null;
|
||||
};
|
||||
|
||||
const useTranscript = (id: string | null): Transcript => {
|
||||
const useTranscript = (api: DefaultApi, id: string | null): Transcript => {
|
||||
const [response, setResponse] = useState<GetTranscript | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [error, setErrorState] = useState<Error | null>(null);
|
||||
const { setError } = useError();
|
||||
const api = getApi();
|
||||
|
||||
const getTranscript = (id: string | null) => {
|
||||
if (!id) throw new Error("Transcript ID is required to get transcript");
|
||||
if (!id) return;
|
||||
|
||||
setLoading(true);
|
||||
const requestParameters: V1TranscriptGetRequest = {
|
||||
|
||||
Reference in New Issue
Block a user