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 } = {}