diff --git a/client/src/pages/play.vue b/client/src/pages/play.vue index a41084f..df60caa 100644 --- a/client/src/pages/play.vue +++ b/client/src/pages/play.vue @@ -1,6 +1,7 @@ @@ -11,12 +12,15 @@ export default { await this.$engine.start() }, computed: { - engineJson() { - return JSON.stringify(this.$store.state.engine.json, null, 2) - }, userJson() { return JSON.stringify(this.$store.state.engine.user, null, 2) }, + gameinfoJson() { + return JSON.stringify(this.$store.state.engine.gameinfo, null, 2) + }, + engineJson() { + return JSON.stringify(this.$store.state.engine.json, null, 2) + }, } } diff --git a/client/src/plugins/engine.js b/client/src/plugins/engine.js index 54c7dee..5dd8008 100644 --- a/client/src/plugins/engine.js +++ b/client/src/plugins/engine.js @@ -24,8 +24,17 @@ export default (context, inject) => { }, }) const response = await $axios.get(url) - const json = response.data - store.commit('engine/setJson', json) + store.commit('engine/setJson', response.data) + + const role = store.state.engine.user?.role + if (role === "gamemaster" || role === "admin") { + const url = buildUrl($config.serverBaseUrl, { + path: '/api/gameinfo', + queryParams: { g: store.state.engine.user?.game }, + }) + const response = await $axios.get(url) + store.commit('engine/setGameinfo', response.data) + } } catch (e) { const { status, statusText } = e.response if (status != 200) { diff --git a/client/src/store/engine.js b/client/src/store/engine.js index 0d3acb9..147a176 100644 --- a/client/src/store/engine.js +++ b/client/src/store/engine.js @@ -2,6 +2,7 @@ export const state = () => ({ json: {}, version: -1, user: undefined, + gameinfo: undefined, }) export const mutations = { @@ -14,5 +15,8 @@ export const mutations = { }, setUser(state, user) { state.user = user + }, + setGameinfo(state, gameinfo) { + state.gameinfo = gameinfo } }