fix bluffs not being cleared

This commit is contained in:
Steffen 2020-05-12 19:59:48 +02:00
parent 2ceee0421b
commit c8d71e7454
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
3 changed files with 10 additions and 4 deletions

View File

@ -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([

View File

@ -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];

View File

@ -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)