imposter get
This commit is contained in:
16
game/game.js
16
game/game.js
@ -12,10 +12,20 @@ async function show_user() {
|
||||
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`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function createImposter() {
|
||||
const res = await fetch(`/api/${sessionId}/${username}/createImposter`);
|
||||
async function getImposter() {
|
||||
const res = await fetch(`/api/${sessionId}/${username}/getImposter`);
|
||||
const stateObj = await res.json();
|
||||
state = stateObj.state;
|
||||
|
||||
if (state == 1) {
|
||||
console.log("du bist imposter");
|
||||
} else {
|
||||
console.log("du bist kein imposter");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user