Added Join button
This commit is contained in:
@@ -35,7 +35,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
const logoutRes = await fetch('/logout', {method: "DELETE"});
|
const logoutRes = await fetch('/logout', {method: "DELETE"});
|
||||||
if (logoutRes.ok) {
|
if (logoutRes.ok) {
|
||||||
document.cookie = "authorization=; Max-Age=0; path=/;";
|
document.cookie = "authorization=; Max-Age=0; path=/;";
|
||||||
window.location.href = "/login";
|
window.location.href = "/login.html";
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Logout error:", err);
|
console.log("Logout error:", err);
|
||||||
@@ -91,11 +91,9 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
const joinRes = await fetch(`/lobby/join?lobbyId=${lobbyId}&username=${username}`);
|
const joinRes = await fetch(`/lobby/join?lobbyId=${lobbyId}&username=${username}`);
|
||||||
if (joinRes.ok) {
|
if (joinRes.ok) {
|
||||||
const {lobbyId: finalLobbyId} = await joinRes.json();
|
const {lobbyId: finalLobbyId} = await joinRes.json();
|
||||||
|
|
||||||
document.getElementById("lobby-id").textContent = finalLobbyId;
|
document.getElementById("lobby-id").textContent = finalLobbyId;
|
||||||
document.getElementById("lobby-room").classList.remove("hidden");
|
document.getElementById("lobby-room").classList.remove("hidden");
|
||||||
joinForm.classList.add("hidden");
|
joinForm.classList.add("hidden");
|
||||||
|
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const res = await fetch(`/lobby/players?lobbyId=${finalLobbyId}`);
|
const res = await fetch(`/lobby/players?lobbyId=${finalLobbyId}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user