fixed engine

This commit is contained in:
Settel 2021-08-15 22:04:10 +02:00
parent 2dd280ce25
commit 85d7ea9086
3 changed files with 18 additions and 7 deletions

View File

@ -3,5 +3,5 @@ export default function(data) {
store.commit('engine/setJson', data)
store.commit('game/setStateAndPhase', data.game)
store.commit('round/setRound', data.game.round)
store.commit('round/setRound', data.game)
}

View File

@ -4,8 +4,14 @@ export const state = () => ({
})
export const mutations = {
setStateAndPhase(state, { state: gameState, phase }) {
state.state = gameState
state.phase = phase
setStateAndPhase(state, game) {
if (game) {
const { state: gameState, phase } = game
state.state = gameState
state.phase = phase
} else{
state.state = ""
state.phase = ""
}
},
}

View File

@ -4,8 +4,13 @@ export const state = () => ({
})
export const mutations = {
setRound(state, { quote, sources }) {
state.quote = quote
state.sources = sources
setRound(state, game) {
if (game && game.round) {
state.quote = game.round.quote
state.sources = game.round.sources
} else {
state.quote = ""
state.sources = []
}
},
}