automatically adds the creator to the lobby

This commit is contained in:
IM23a-cernik
2025-04-17 15:30:05 +02:00
parent 996bc1907d
commit 5e9bb54af9
+2 -2
View File
@@ -22,12 +22,12 @@ async function joinLobby(lobbyId, player_name) {
app.get("/lobby/create", async (req, res) => { app.get("/lobby/create", async (req, res) => {
let lobbyId = await createLobby(); let lobbyId = await createLobby();
res.send(lobbyId); res.send(lobbyId).redirect("/lobby/join");
}) })
app.get("/lobby/join", async (req, res) => { app.get("/lobby/join", async (req, res) => {
let lobbyId = req.query.lobbyId; let lobbyId = req.query.lobbyId;
let name = req.query.name; let name = req.body.username;
const users = get_data(); const users = get_data();
const user = (users.find(u => u.username === name)) const user = (users.find(u => u.username === name))