From 34e1a19a64237e2c84ca43e2ee44914f051b9d05 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 2 Jan 2021 18:37:05 -0700 Subject: [PATCH] Fix bug that allowed people to start games when cancelling the name entry. --- web/src/views/CreateJoin.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/src/views/CreateJoin.vue b/web/src/views/CreateJoin.vue index a49cf1c..9c19465 100644 --- a/web/src/views/CreateJoin.vue +++ b/web/src/views/CreateJoin.vue @@ -23,9 +23,12 @@ export default { createGame() { this.name = prompt(`What is your name?`); - this.$socket.client.emit(`CreateGame`, { - name: this.name, - }); + // Assert that the user entered a name and didn't cancel + if (this.name) { + this.$socket.client.emit(`CreateGame`, { + name: this.name, + }); + }; }, joinGame() { // Get the user's name