From aebbdf877ed32ab2be93fd58aa6728d949a48315 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 21 Oct 2020 21:13:22 -0600 Subject: [PATCH] Add functionality to the kill/leave game buttons --- src/views/Lobby.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/views/Lobby.vue b/src/views/Lobby.vue index b3e7412..02b3322 100644 --- a/src/views/Lobby.vue +++ b/src/views/Lobby.vue @@ -38,10 +38,10 @@

- +
- +
@@ -86,11 +86,17 @@ export default { if (this.is_host) { let cont = confirm(`Are you sure you want to exit`); if (cont) { - alert(`exiting game`) + this.$socket.emit(`KillGame`, { + game_code: this.game_code, + user: this.username, + }); }; } else { - this.$socket.emit(`LeaveGame`, { - username: this.username + this.$socket.emit(`KickPlayer`, { + game_code: this.game_code, + target: this.username, + user: this.username, + ban: false, }); }; }, @@ -120,7 +126,7 @@ export default { PlayerKicked(data) { if (data.player === this.username) { this.$emit(`alert`, { - message: `You have been kicked from the game by the host.`, + message: `You have been removed from the game.`, classes: [`error`], }); setTimeout(() => { @@ -130,7 +136,7 @@ export default { }); this.$emit(`go-to`, `game-type`); }, 2000); - } + }; this.players = this.players.filter(x => x !== data.player); } },