Add players array and related mutations.
This commit is contained in:
parent
6cd11b7563
commit
fb6cfd8218
1 changed files with 15 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ export default new Vuex.Store({
|
|||
chosen_object: null,
|
||||
questions: [],
|
||||
game_code: null,
|
||||
players: [],
|
||||
},
|
||||
getters: {
|
||||
teamName(state) {
|
||||
|
|
@ -78,6 +79,20 @@ export default new Vuex.Store({
|
|||
view(state, target) {
|
||||
state.view = target;
|
||||
},
|
||||
playerList(state, players) {
|
||||
state.players = players;
|
||||
},
|
||||
updatePlayer(state, data) {
|
||||
for (var player of state.players) {
|
||||
if (player.name == data.name) {
|
||||
player.role = data.role;
|
||||
player.team = data.team;
|
||||
};
|
||||
};
|
||||
},
|
||||
newPlayer(state, player) {
|
||||
state.players.push(player);
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue