From 7c0f31584c4150dec2962570520ea13a55ae8855 Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 14 Dec 2020 21:49:40 +0100 Subject: [PATCH] simplify session URLs --- src/components/Menu.vue | 4 ++-- src/store/socket.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 0fcf5af..bedc38d 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -172,7 +172,7 @@
  • Game State JSON - +
  • @@ -253,7 +253,7 @@ export default { .then(({ state }) => { if (state === "granted" || state === "prompt") { const url = window.location.href.split("#")[0]; - const link = url + "#play/" + this.session.sessionId; + const link = url + "#" + this.session.sessionId; navigator.clipboard.writeText(link); } }); diff --git a/src/store/socket.js b/src/store/socket.js index 6a4494d..ba45315 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -736,9 +736,9 @@ export default store => { }); // check for session Id in hash - const [command, param] = window.location.hash.substr(1).split("/"); - if (command === "play") { + const sessionId = window.location.hash.substr(1); + if (sessionId) { store.commit("session/setSpectator", true); - store.commit("session/setSessionId", param); + store.commit("session/setSessionId", sessionId); } };