From 3545b3a69d504bd952f66723328a7daaa0eddbda Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 25 Dec 2020 20:30:31 +0100 Subject: [PATCH] fix sessionId handling for URLs --- src/components/Menu.vue | 16 ++-------------- src/store/modules/session.js | 7 ++++++- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index c8d6649..fe4612c 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -241,13 +241,7 @@ export default { if (sessionId) { this.$store.commit("session/clearVoteHistory"); this.$store.commit("session/setSpectator", false); - this.$store.commit( - "session/setSessionId", - sessionId - .toLocaleLowerCase() - .replace(/[^0-9a-z]/g, "") - .substr(0, 10) - ); + this.$store.commit("session/setSessionId", sessionId); this.copySessionUrl(); } }, @@ -286,13 +280,7 @@ export default { this.$store.commit("session/clearVoteHistory"); this.$store.commit("session/setSpectator", true); this.$store.commit("toggleGrimoire", false); - this.$store.commit( - "session/setSessionId", - sessionId - .toLocaleLowerCase() - .replace(/[^0-9a-z]/g, "") - .substr(0, 10) - ); + this.$store.commit("session/setSessionId", sessionId); } }, leaveSession() { diff --git a/src/store/modules/session.js b/src/store/modules/session.js index c683212..152eba6 100644 --- a/src/store/modules/session.js +++ b/src/store/modules/session.js @@ -38,7 +38,6 @@ const getters = {}; const actions = {}; const mutations = { - setSessionId: set("sessionId"), setPlayerId: set("playerId"), setSpectator: set("isSpectator"), setReconnecting: set("isReconnecting"), @@ -48,6 +47,12 @@ const mutations = { setVoteInProgress: set("isVoteInProgress"), claimSeat: set("claimedSeat"), distributeRoles: set("isRolesDistributed"), + setSessionId(state, sessionId) { + state.sessionId = sessionId + .toLocaleLowerCase() + .replace(/[^0-9a-z]/g, "") + .substr(0, 10); + }, nomination( state, { nomination, votes, votingSpeed, lockedVote, isVoteInProgress } = {}