From 0e1cdbbb35cc236e31dff97c2e4b2a0a611d7f03 Mon Sep 17 00:00:00 2001 From: Alexander Fletcher Date: Mon, 30 May 2022 20:13:56 +0800 Subject: [PATCH] use saved pronouns and remove when leaving seat --- src/components/Player.vue | 4 ++++ src/store/socket.js | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index 65bdf61..85c7da4 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -333,6 +333,10 @@ export default { claimSeat() { this.isMenuOpen = false; this.$emit("trigger", ["claimSeat"]); + const savedPronouns = localStorage.getItem("pronouns"); + if (savedPronouns) { + this.updatePlayer("pronouns", savedPronouns); + } }, /** * Allow the ST to override a locked vote. diff --git a/src/store/socket.js b/src/store/socket.js index dd6fd5b..319cde4 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -627,14 +627,18 @@ class LiveSession { */ _updateSeat([index, value]) { if (this._isSpectator) return; - const property = "id"; const players = this._store.state.players.players; // remove previous seat const oldIndex = players.findIndex(({ id }) => id === value); if (oldIndex >= 0 && oldIndex !== index) { this._store.commit("players/update", { player: players[oldIndex], - property, + property: "id", + value: "" + }); + this._store.commit("players/update", { + player: players[oldIndex], + property: "pronouns", value: "" }); } @@ -642,7 +646,7 @@ class LiveSession { if (index >= 0) { const player = players[index]; if (!player) return; - this._store.commit("players/update", { player, property, value }); + this._store.commit("players/update", { player, property: "id", value }); } // update player session list as if this was a ping this._handlePing([true, value, 0]);