diff --git a/truthseeker/static/js/game_lobby.js b/truthseeker/static/js/game_lobby.js index 3cd4f50..401a2aa 100644 --- a/truthseeker/static/js/game_lobby.js +++ b/truthseeker/static/js/game_lobby.js @@ -127,7 +127,8 @@ function joinRoom() { */ function copyCode() { // Get the room code from the displayed text to avoid an extra API call - let roomCode = document.getElementsByClassName("room_code")[0].textContent; + let roomCode = getRoomCode(); + console.log(roomCode); if (roomCode == "") { alert("Veuillez patientez, le code d'équipe est en cours de génération."); } @@ -295,7 +296,8 @@ function getChallengeModeRoundsCount() { * @returns the code of the room */ function getRoomCode() { - gameid = document.getElementById("gameid") + gameid = document.getElementById("game_id").value; + console.log(gameid); return gameid; } @@ -331,6 +333,8 @@ function initLobby() { socket.on("playersjoin", (err) => { console.log(`Failed to connect to socket: ${err.message}`); }); + + if (hasJoinedRoom()) { displayRoomView(); if (isRoomOwner()) { diff --git a/truthseeker/static/js/game_start_page.js b/truthseeker/static/js/game_start_page.js index 53f2b5a..0c6d66d 100644 --- a/truthseeker/static/js/game_start_page.js +++ b/truthseeker/static/js/game_start_page.js @@ -238,7 +238,7 @@ async function joinGame(){ //alert(value["msg"]); } else{ - //window.location.href = "/lobby/" + gameid; + window.location.href = "/lobby/" + gameid; } }) } diff --git a/truthseeker/templates/lobby.html b/truthseeker/templates/lobby.html index e7602f2..220099e 100644 --- a/truthseeker/templates/lobby.html +++ b/truthseeker/templates/lobby.html @@ -8,6 +8,7 @@
+