mirror of https://github.com/bra1n/townsquare.git
fix bluffs not being cleared
This commit is contained in:
parent
2ceee0421b
commit
c8d71e7454
|
@ -153,13 +153,14 @@ export default {
|
||||||
if (this.grimoire.isSpectator) return;
|
if (this.grimoire.isSpectator) return;
|
||||||
if (confirm("Are you sure you want to remove all players?")) {
|
if (confirm("Are you sure you want to remove all players?")) {
|
||||||
this.$store.commit("players/clear");
|
this.$store.commit("players/clear");
|
||||||
|
this.$store.commit("setBluff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clearRoles() {
|
clearRoles() {
|
||||||
if (this.grimoire.isSpectator) return;
|
if (this.grimoire.isSpectator) return;
|
||||||
this.$store.commit("showGrimoire");
|
|
||||||
if (confirm("Are you sure you want to remove all player roles?")) {
|
if (confirm("Are you sure you want to remove all player roles?")) {
|
||||||
this.$store.dispatch("players/clearRoles");
|
this.$store.dispatch("players/clearRoles");
|
||||||
|
this.$store.commit("setBluff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
|
|
|
@ -35,6 +35,8 @@ export default new Vuex.Store({
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
background: "",
|
background: "",
|
||||||
bluffs: [],
|
bluffs: [],
|
||||||
|
},
|
||||||
|
session: {
|
||||||
sessionId: "",
|
sessionId: "",
|
||||||
isSpectator: false
|
isSpectator: false
|
||||||
},
|
},
|
||||||
|
@ -76,8 +78,12 @@ export default new Vuex.Store({
|
||||||
setSpectator({ grimoire }, spectator) {
|
setSpectator({ grimoire }, spectator) {
|
||||||
grimoire.isSpectator = spectator;
|
grimoire.isSpectator = spectator;
|
||||||
},
|
},
|
||||||
setBluff({ grimoire }, { index, role }) {
|
setBluff({ grimoire }, { index, role } = {}) {
|
||||||
grimoire.bluffs.splice(index, 1, role);
|
if (index !== undefined) {
|
||||||
|
grimoire.bluffs.splice(index, 1, role);
|
||||||
|
} else {
|
||||||
|
grimoire.bluffs = [];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toggleModal({ modals }, name) {
|
toggleModal({ modals }, name) {
|
||||||
modals[name] = !modals[name];
|
modals[name] = !modals[name];
|
||||||
|
|
|
@ -32,7 +32,6 @@ module.exports = store => {
|
||||||
store.subscribe(({ type, payload }, state) => {
|
store.subscribe(({ type, payload }, state) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "toggleGrimoire":
|
case "toggleGrimoire":
|
||||||
case "showGrimoire":
|
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"isPublic",
|
"isPublic",
|
||||||
JSON.stringify(state.grimoire.isPublic)
|
JSON.stringify(state.grimoire.isPublic)
|
||||||
|
|
Loading…
Reference in New Issue