From 69b7757fa189d10d913302309a1e14ed8454199a Mon Sep 17 00:00:00 2001 From: IM23a-cernik Date: Mon, 28 Apr 2025 14:39:51 +0200 Subject: [PATCH] attempt at fixing ability to join non-existent lobbies --- lobby.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lobby.js b/lobby.js index eb35ed1..16b67ec 100644 --- a/lobby.js +++ b/lobby.js @@ -16,8 +16,10 @@ async function createLobby() { } async function joinLobby(lobbyId, player_name) { - let response = await fetch(`https://www.deckofcardsapi.com/api/deck/${lobbyId}/pile/${player_name}/add/?cards=`) - console.log(response); + if (playerMap[lobbyId]) { + let response = await fetch(`https://www.deckofcardsapi.com/api/deck/${lobbyId}/pile/${player_name}/add/?cards=`) + console.log(response); + } else console.log("Lobby with "+lobbyId+" not found."); } app.get("/lobby/create", async (req, res) => {