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,
|
chosen_object: null,
|
||||||
questions: [],
|
questions: [],
|
||||||
game_code: null,
|
game_code: null,
|
||||||
|
players: [],
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
teamName(state) {
|
teamName(state) {
|
||||||
|
|
@ -78,6 +79,20 @@ export default new Vuex.Store({
|
||||||
view(state, target) {
|
view(state, target) {
|
||||||
state.view = 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: {
|
actions: {
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue