imposter creation
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/game/">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>game</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="./game.js" ></script>
|
||||
</body>
|
||||
</html>
|
||||
21
game/game.js
21
game/game.js
@ -0,0 +1,21 @@
|
||||
const parts = window.location.pathname.split("/").filter(Boolean);
|
||||
const sessionId = parts[0] ?? null;
|
||||
const username = parts[1] ?? null;
|
||||
|
||||
async function getState() {
|
||||
const res = await fetch(`/api/${sessionId}/${username}/state`);
|
||||
const state = await res.json();
|
||||
}
|
||||
|
||||
async function show_user() {
|
||||
const res = await fetch(`/api/user/${sessionId}`);
|
||||
const users = await res.json();
|
||||
const allUsers = users.map((u) => u.state);
|
||||
if (allUsers.every((v) => v === 0)) {
|
||||
console.log("test");
|
||||
}
|
||||
}
|
||||
|
||||
async function createImposter() {
|
||||
const res = await fetch(`/api/${sessionId}/${username}/createImposter`);
|
||||
}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
body {
|
||||
background-color: #09161e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user