From 17bec179cd8c0531654f7856899b2d48f83be876 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Thu, 22 Oct 2020 23:37:24 -0600 Subject: [PATCH] Add StartGame handling --- src/views/Lobby.vue | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/views/Lobby.vue b/src/views/Lobby.vue index 0f030cc..053d600 100644 --- a/src/views/Lobby.vue +++ b/src/views/Lobby.vue @@ -36,8 +36,7 @@
- -
+
@@ -108,6 +107,12 @@ export default { ban: false, }); }, + start_game() { + this.$socket.emit(`StartGame`, { + game_code: this.game_code, + user: this.username, + }); + }, }, sockets: { PlayerList(data) { @@ -156,6 +161,19 @@ export default { }, 3000); }; }, + Starting(data) { + if (!data.success) { + this.$emit(`alert`, { + message: data.message, + classes: [`error`] + }); + setTimeout(() => { + this.$emit(`alert`, { message: ``, classes: [] }, 3000) + }) + } else { + this.$emit(`go-to`, `in-game`); + }; + } }, }