mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
www: ensure login waited before recording
if you refresh the record page, it does not work and return 404 because the transcript is accessed without token
This commit is contained in:
@@ -35,7 +35,7 @@ export default function TranscriptDetails(details: TranscriptDetails) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (requireLogin && !isAuthenticated) return;
|
if (requireLogin && !isAuthenticated) return;
|
||||||
setTranscriptId(details.params.transcriptId);
|
setTranscriptId(details.params.transcriptId);
|
||||||
}, [api]);
|
}, [api, details.params.transcriptId, isAuthenticated]);
|
||||||
|
|
||||||
if (transcript?.error /** || topics?.error || waveform?.error **/) {
|
if (transcript?.error /** || topics?.error || waveform?.error **/) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import DisconnectedIndicator from "../../disconnectedIndicator";
|
|||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { faGear } from "@fortawesome/free-solid-svg-icons";
|
import { faGear } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { lockWakeState, releaseWakeState } from "../../../../lib/wakeLock";
|
import { lockWakeState, releaseWakeState } from "../../../../lib/wakeLock";
|
||||||
|
import { featRequireLogin } from "../../../../../app/lib/utils";
|
||||||
|
import { useFiefIsAuthenticated } from "@fief/fief/nextjs/react";
|
||||||
|
|
||||||
type TranscriptDetails = {
|
type TranscriptDetails = {
|
||||||
params: {
|
params: {
|
||||||
@@ -36,16 +38,23 @@ const TranscriptRecord = (details: TranscriptDetails) => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const isAuthenticated = useFiefIsAuthenticated();
|
||||||
const api = getApi();
|
const api = getApi();
|
||||||
const transcript = useTranscript(api, details.params.transcriptId);
|
const [transcriptId, setTranscriptId] = useState<string>("");
|
||||||
const webRTC = useWebRTC(stream, details.params.transcriptId, api);
|
const transcript = useTranscript(api, transcriptId);
|
||||||
const webSockets = useWebSockets(details.params.transcriptId);
|
const webRTC = useWebRTC(stream, transcriptId, api);
|
||||||
|
const webSockets = useWebSockets(transcriptId);
|
||||||
|
|
||||||
const { audioDevices, getAudioStream } = useAudioDevice();
|
const { audioDevices, getAudioStream } = useAudioDevice();
|
||||||
|
|
||||||
const [hasRecorded, setHasRecorded] = useState(false);
|
const [hasRecorded, setHasRecorded] = useState(false);
|
||||||
const [transcriptStarted, setTranscriptStarted] = useState(false);
|
const [transcriptStarted, setTranscriptStarted] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (featRequireLogin() && !isAuthenticated) return;
|
||||||
|
setTranscriptId(details.params.transcriptId);
|
||||||
|
}, [api, details.params.transcriptId, isAuthenticated]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!transcriptStarted && webSockets.transcriptText.length !== 0)
|
if (!transcriptStarted && webSockets.transcriptText.length !== 0)
|
||||||
setTranscriptStarted(true);
|
setTranscriptStarted(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user