mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
correction user-joined
This commit is contained in:
parent
5c736f4ca0
commit
c9b76df2cd
1 changed files with 14 additions and 1 deletions
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue