Request player list on component mount if the player is the host

This commit is contained in:
Oliver-Akins 2020-09-28 22:32:53 -06:00
parent 24c5220843
commit 08c59ef30c

View file

@ -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`, {