Skip to content

Commit

Permalink
Merge pull request #24 from SimerusM/dev
Browse files Browse the repository at this point in the history
integrated meeting leave
  • Loading branch information
SimerusM authored Aug 31, 2024
2 parents 0c24197 + ccecfe0 commit b6a1926
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/src/pages/MeetingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const MeetingPage = () => {
const chatHandler = useRef(null);
const [chatHistory, setChatHistory] = useState([]);

const errorHandler = (error) => {
console.error(error);
navigate('/');
toast.error(error.message);
}

const initializeMeeting = async () => {
if (!username) {
toast.error('Please enter a username before joining a meeting.');
Expand Down Expand Up @@ -58,11 +64,7 @@ const MeetingPage = () => {
chatHandler.current = new ChatHandler(meeting_id, username, socketRef.current, setChatHistory);
chatHandler.current.initialize();

const handlePeerUpdate = (update) => {
setPeers(prevPeers => ({ ...prevPeers, ...update }));
console.debug('Updated peers:', peers);
}
rtcHandler.current = new RTCHandler(meeting_id, username, socketRef.current, handlePeerUpdate);
rtcHandler.current = new RTCHandler(meeting_id, username, socketRef.current, setPeers, errorHandler);
rtcHandler.current.initialize();
};

Expand Down

0 comments on commit b6a1926

Please sign in to comment.