correction user-joined

This commit is contained in:
NouhailaAater 2025-02-22 01:23:42 -05:00
parent 5c736f4ca0
commit c9b76df2cd

View file

@ -189,6 +189,18 @@ const ManageRoom: React.FC = () => {
setConnectingError(errorMessage);
console.error('Erreur création salle:', errorMessage);
});
socket.on('user-joined', (student: StudentType) => {
console.log(`Student joined: name = ${student.name}, id = ${student.id}`);
setStudents((prevStudents) => [...prevStudents, student]);
if (quizMode === 'teacher') {
webSocketService.nextQuestion(roomName, currentQuestion);
} else if (quizMode === 'student') {
webSocketService.launchStudentModeQuiz(roomName, quizQuestions);
}
});
};
if (rooms.length === 0) {
@ -221,6 +233,7 @@ const ManageRoom: React.FC = () => {
console.log(`Listening for user-joined in room ${roomName}`);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
socket.on('user-joined', (_student: StudentType) => {
console.log("📢 Nouvel étudiant ajouté:", _student);
if (quizMode === 'teacher') {
webSocketService.nextQuestion(roomName, currentQuestion);
} else if (quizMode === 'student') {