mirror of https://github.com/bra1n/townsquare.git
simplify session URLs
This commit is contained in:
parent
41af82cc5c
commit
7c0f31584c
|
@ -172,7 +172,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li @click="toggleModal('gameState')">
|
<li @click="toggleModal('gameState')">
|
||||||
Game State JSON
|
Game State JSON
|
||||||
<em><font-awesome-icon icon="file-code" /></em>
|
<em><font-awesome-icon icon="file-code"/></em>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://discord.gg/Gd7ybwWbFk" target="_blank">
|
<a href="https://discord.gg/Gd7ybwWbFk" target="_blank">
|
||||||
|
@ -253,7 +253,7 @@ export default {
|
||||||
.then(({ state }) => {
|
.then(({ state }) => {
|
||||||
if (state === "granted" || state === "prompt") {
|
if (state === "granted" || state === "prompt") {
|
||||||
const url = window.location.href.split("#")[0];
|
const url = window.location.href.split("#")[0];
|
||||||
const link = url + "#play/" + this.session.sessionId;
|
const link = url + "#" + this.session.sessionId;
|
||||||
navigator.clipboard.writeText(link);
|
navigator.clipboard.writeText(link);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -736,9 +736,9 @@ export default store => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// check for session Id in hash
|
// check for session Id in hash
|
||||||
const [command, param] = window.location.hash.substr(1).split("/");
|
const sessionId = window.location.hash.substr(1);
|
||||||
if (command === "play") {
|
if (sessionId) {
|
||||||
store.commit("session/setSpectator", true);
|
store.commit("session/setSpectator", true);
|
||||||
store.commit("session/setSessionId", param);
|
store.commit("session/setSessionId", sessionId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue