mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
Urgent Fix for "Rules of Hooks" error
This commit is contained in:
@@ -6,6 +6,7 @@ import useWebRTC from "../useWebRTC";
|
|||||||
import useTranscript from "../useTranscript";
|
import useTranscript from "../useTranscript";
|
||||||
import { useWebSockets } from "../useWebSockets";
|
import { useWebSockets } from "../useWebSockets";
|
||||||
import "../../styles/button.css";
|
import "../../styles/button.css";
|
||||||
|
import getApi from "../../lib/getApi";
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [stream, setStream] = useState<MediaStream | null>(null);
|
const [stream, setStream] = useState<MediaStream | null>(null);
|
||||||
@@ -21,8 +22,9 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const api = getApi();
|
||||||
const transcript = useTranscript();
|
const transcript = useTranscript();
|
||||||
const webRTC = useWebRTC(stream, transcript.response?.id);
|
const webRTC = useWebRTC(stream, transcript.response?.id, api);
|
||||||
const webSockets = useWebSockets(transcript.response?.id);
|
const webSockets = useWebSockets(transcript.response?.id);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
V1TranscriptRecordWebrtcRequest,
|
V1TranscriptRecordWebrtcRequest,
|
||||||
} from "../api/apis/DefaultApi";
|
} from "../api/apis/DefaultApi";
|
||||||
import { Configuration } from "../api/runtime";
|
import { Configuration } from "../api/runtime";
|
||||||
import getApi from "../lib/getApi";
|
|
||||||
|
|
||||||
const useWebRTC = (
|
const useWebRTC = (
|
||||||
stream: MediaStream | null,
|
stream: MediaStream | null,
|
||||||
transcriptId: string | null,
|
transcriptId: string | null,
|
||||||
|
api: DefaultApi,
|
||||||
): Peer => {
|
): Peer => {
|
||||||
const [peer, setPeer] = useState<Peer | null>(null);
|
const [peer, setPeer] = useState<Peer | null>(null);
|
||||||
|
|
||||||
@@ -18,8 +18,6 @@ const useWebRTC = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const api = getApi();
|
|
||||||
|
|
||||||
let p: Peer = new Peer({ initiator: true, stream: stream });
|
let p: Peer = new Peer({ initiator: true, stream: stream });
|
||||||
|
|
||||||
p.on("signal", (data: any) => {
|
p.on("signal", (data: any) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user