From 85d7ea908617179c3e563f55fff827174e6086e3 Mon Sep 17 00:00:00 2001 From: Settel Date: Sun, 15 Aug 2021 22:04:10 +0200 Subject: [PATCH] fixed engine --- client/src/plugins/engine/parseSyncData.js | 2 +- client/src/store/game.js | 12 +++++++++--- client/src/store/round.js | 11 ++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/client/src/plugins/engine/parseSyncData.js b/client/src/plugins/engine/parseSyncData.js index e0e4a97..17b8734 100644 --- a/client/src/plugins/engine/parseSyncData.js +++ b/client/src/plugins/engine/parseSyncData.js @@ -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) } diff --git a/client/src/store/game.js b/client/src/store/game.js index 1929d86..2a56935 100644 --- a/client/src/store/game.js +++ b/client/src/store/game.js @@ -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 = "" + } }, } diff --git a/client/src/store/round.js b/client/src/store/round.js index 530e372..0d48c9e 100644 --- a/client/src/store/round.js +++ b/client/src/store/round.js @@ -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 = [] + } }, }