diff --git a/src/components/Player.vue b/src/components/Player.vue index 3a3e864..4e5fdf1 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -240,12 +240,12 @@ export default { }, methods: { changePronoun() { - if (this.session.isSpectator) return; - const pronoun = - prompt("Player preffered pronouns", this.player.pronoun) || - this.player.pronoun; - this.updatePlayer("pronoun", pronoun, true); - this.$emit("trigger", ["updatePlayer", this.player, "pronoun", pronoun]); + const pronoun = prompt("Player preffered pronouns", this.player.pronoun); + this.$store.commit("players/setPronoun", { + player: this.player, + pronoun + }); + this.isMenuOpen = false; }, toggleStatus() { if (this.grimoire.isPublic) { diff --git a/src/store/modules/players.js b/src/store/modules/players.js index 83bd351..a04879b 100644 --- a/src/store/modules/players.js +++ b/src/store/modules/players.js @@ -107,6 +107,12 @@ const mutations = { state.players[index][property] = value; } }, + setPronoun(state, { player, pronoun }) { + const index = state.players.indexOf(player); + if (index >= 0) { + state.players[index].pronoun = pronoun; + } + }, add(state, name) { state.players.push({ ...NEWPLAYER, diff --git a/src/store/persistence.js b/src/store/persistence.js index fbd22ab..a0282fe 100644 --- a/src/store/persistence.js +++ b/src/store/persistence.js @@ -122,6 +122,7 @@ module.exports = store => { case "players/set": case "players/swap": case "players/move": + case "players/setPronoun": if (state.players.players.length) { localStorage.setItem( "players",