diff --git a/src/components/Menu.vue b/src/components/Menu.vue index be7633b..aacd745 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -153,13 +153,14 @@ export default { if (this.grimoire.isSpectator) return; if (confirm("Are you sure you want to remove all players?")) { this.$store.commit("players/clear"); + this.$store.commit("setBluff"); } }, clearRoles() { if (this.grimoire.isSpectator) return; - this.$store.commit("showGrimoire"); if (confirm("Are you sure you want to remove all player roles?")) { this.$store.dispatch("players/clearRoles"); + this.$store.commit("setBluff"); } }, ...mapMutations([ diff --git a/src/store/index.js b/src/store/index.js index 36891ab..176fbe9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -35,6 +35,8 @@ export default new Vuex.Store({ zoom: 1, background: "", bluffs: [], + }, + session: { sessionId: "", isSpectator: false }, @@ -76,8 +78,12 @@ export default new Vuex.Store({ setSpectator({ grimoire }, spectator) { grimoire.isSpectator = spectator; }, - setBluff({ grimoire }, { index, role }) { - grimoire.bluffs.splice(index, 1, role); + setBluff({ grimoire }, { index, role } = {}) { + if (index !== undefined) { + grimoire.bluffs.splice(index, 1, role); + } else { + grimoire.bluffs = []; + } }, toggleModal({ modals }, name) { modals[name] = !modals[name]; diff --git a/src/store/persistence.js b/src/store/persistence.js index 1ae71f0..23dc8b0 100644 --- a/src/store/persistence.js +++ b/src/store/persistence.js @@ -32,7 +32,6 @@ module.exports = store => { store.subscribe(({ type, payload }, state) => { switch (type) { case "toggleGrimoire": - case "showGrimoire": localStorage.setItem( "isPublic", JSON.stringify(state.grimoire.isPublic)