Request player list on component mount if the player is the host
This commit is contained in:
parent
24c5220843
commit
08c59ef30c
1 changed files with 9 additions and 0 deletions
|
|
@ -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`, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue