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('engine/setJson', data)
store.commit('game/setStateAndPhase', data.game) 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 = { export const mutations = {
setStateAndPhase(state, { state: gameState, phase }) { setStateAndPhase(state, game) {
state.state = gameState if (game) {
state.phase = phase 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 = { export const mutations = {
setRound(state, { quote, sources }) { setRound(state, game) {
state.quote = quote if (game && game.round) {
state.sources = sources state.quote = game.round.quote
state.sources = game.round.sources
} else {
state.quote = ""
state.sources = []
}
}, },
} }