20 lines
562 B
JavaScript
20 lines
562 B
JavaScript
// public/js/lobby.js
|
|
|
|
import { getParam } from "./utils.js";
|
|
|
|
const username = getParam("username");
|
|
|
|
document.getElementById("createGame").addEventListener("click", () => {
|
|
if (!username) {
|
|
alert("Kein Username gefunden!");
|
|
return;
|
|
}
|
|
window.location.href = `/create-game.html?username=${encodeURIComponent(username)}`;
|
|
});
|
|
|
|
document.getElementById("joinGame").addEventListener("click", () => {
|
|
window.location.href = username
|
|
? `/join-game.html?username=${encodeURIComponent(username)}`
|
|
: "/join-game.html";
|
|
});
|