fix sessionId handling for URLs

This commit is contained in:
Steffen 2020-12-25 20:30:31 +01:00
parent 6d8409d0f0
commit 3545b3a69d
2 changed files with 8 additions and 15 deletions

View File

@ -241,13 +241,7 @@ export default {
if (sessionId) { if (sessionId) {
this.$store.commit("session/clearVoteHistory"); this.$store.commit("session/clearVoteHistory");
this.$store.commit("session/setSpectator", false); this.$store.commit("session/setSpectator", false);
this.$store.commit( this.$store.commit("session/setSessionId", sessionId);
"session/setSessionId",
sessionId
.toLocaleLowerCase()
.replace(/[^0-9a-z]/g, "")
.substr(0, 10)
);
this.copySessionUrl(); this.copySessionUrl();
} }
}, },
@ -286,13 +280,7 @@ export default {
this.$store.commit("session/clearVoteHistory"); this.$store.commit("session/clearVoteHistory");
this.$store.commit("session/setSpectator", true); this.$store.commit("session/setSpectator", true);
this.$store.commit("toggleGrimoire", false); this.$store.commit("toggleGrimoire", false);
this.$store.commit( this.$store.commit("session/setSessionId", sessionId);
"session/setSessionId",
sessionId
.toLocaleLowerCase()
.replace(/[^0-9a-z]/g, "")
.substr(0, 10)
);
} }
}, },
leaveSession() { leaveSession() {

View File

@ -38,7 +38,6 @@ const getters = {};
const actions = {}; const actions = {};
const mutations = { const mutations = {
setSessionId: set("sessionId"),
setPlayerId: set("playerId"), setPlayerId: set("playerId"),
setSpectator: set("isSpectator"), setSpectator: set("isSpectator"),
setReconnecting: set("isReconnecting"), setReconnecting: set("isReconnecting"),
@ -48,6 +47,12 @@ const mutations = {
setVoteInProgress: set("isVoteInProgress"), setVoteInProgress: set("isVoteInProgress"),
claimSeat: set("claimedSeat"), claimSeat: set("claimedSeat"),
distributeRoles: set("isRolesDistributed"), distributeRoles: set("isRolesDistributed"),
setSessionId(state, sessionId) {
state.sessionId = sessionId
.toLocaleLowerCase()
.replace(/[^0-9a-z]/g, "")
.substr(0, 10);
},
nomination( nomination(
state, state,
{ nomination, votes, votingSpeed, lockedVote, isVoteInProgress } = {} { nomination, votes, votingSpeed, lockedVote, isVoteInProgress } = {}