From 08c59ef30c22032fa813ba85862f8d0b955638fd Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 28 Sep 2020 22:32:53 -0600 Subject: [PATCH] Request player list on component mount if the player is the host --- src/views/Lobby.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/views/Lobby.vue b/src/views/Lobby.vue index 2181dba..fa7ef61 100644 --- a/src/views/Lobby.vue +++ b/src/views/Lobby.vue @@ -21,6 +21,15 @@ export default { data() {return { players: [] }}, + mounted() { + this.game_code = sessionStorage.getItem(`game-code`); + this.is_host = JSON.parse(sessionStorage.getItem(`is-host`)); + + // Get the player data if the host loaded the component + if (this.is_host) { + this.$nextTick(() => this.getPlayerList()); + }; + }, methods: { getPlayerList() { this.$socket.emit(`GetPlayerList`, {