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) {
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() {

View File

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