mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19: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(() => {
|
||||
if (requireLogin && !isAuthenticated) return;
|
||||
setTranscriptId(details.params.transcriptId);
|
||||
}, [api]);
|
||||
}, [api, details.params.transcriptId, isAuthenticated]);
|
||||
|
||||
if (transcript?.error /** || topics?.error || waveform?.error **/) {
|
||||
return (
|
||||
|
||||
@@ -14,6 +14,8 @@ import DisconnectedIndicator from "../../disconnectedIndicator";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faGear } from "@fortawesome/free-solid-svg-icons";
|
||||
import { lockWakeState, releaseWakeState } from "../../../../lib/wakeLock";
|
||||
import { featRequireLogin } from "../../../../../app/lib/utils";
|
||||
import { useFiefIsAuthenticated } from "@fief/fief/nextjs/react";
|
||||
|
||||
type TranscriptDetails = {
|
||||
params: {
|
||||
@@ -36,16 +38,23 @@ const TranscriptRecord = (details: TranscriptDetails) => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const isAuthenticated = useFiefIsAuthenticated();
|
||||
const api = getApi();
|
||||
const transcript = useTranscript(api, details.params.transcriptId);
|
||||
const webRTC = useWebRTC(stream, details.params.transcriptId, api);
|
||||
const webSockets = useWebSockets(details.params.transcriptId);
|
||||
const [transcriptId, setTranscriptId] = useState<string>("");
|
||||
const transcript = useTranscript(api, transcriptId);
|
||||
const webRTC = useWebRTC(stream, transcriptId, api);
|
||||
const webSockets = useWebSockets(transcriptId);
|
||||
|
||||
const { audioDevices, getAudioStream } = useAudioDevice();
|
||||
|
||||
const [hasRecorded, setHasRecorded] = useState(false);
|
||||
const [transcriptStarted, setTranscriptStarted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (featRequireLogin() && !isAuthenticated) return;
|
||||
setTranscriptId(details.params.transcriptId);
|
||||
}, [api, details.params.transcriptId, isAuthenticated]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!transcriptStarted && webSockets.transcriptText.length !== 0)
|
||||
setTranscriptStarted(true);
|
||||
|
||||
Reference in New Issue
Block a user