On create or join, now retrieves initial game state form server and prints it in the console

This commit is contained in:
Maier
2019-08-30 13:29:12 -04:00
parent 0d27d2913b
commit df492f7187
4 changed files with 20 additions and 11 deletions

View File

@@ -83,16 +83,16 @@ function createGame() {
code += charPool[getRandomInt(61)]
}
console.log(code);
let id = socket.id
const game = new Game(
code,
gameSize,
deck,
document.getElementById("time").value,
[document.getElementById("name").value]
{ [socket.id]: document.getElementById("name").value }
);
socket.emit('newGame', game);
sessionStorage.setItem('accessCode', code);
sessionStorage.setItem('code', code);
window.location.replace('/' + code);
}