small fixes

This commit is contained in:
Steffen 2020-05-09 21:56:51 +02:00
parent 791c4b322f
commit 2ceee0421b
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
2 changed files with 8 additions and 5 deletions

View File

@ -45,7 +45,7 @@
</li>
<li class="headline" v-if="grimoire.sessionId">
<font-awesome-icon icon="broadcast-tower" />
{{ grimoire.isSpectator ? "Spectating" : "Hosting" }}
{{ grimoire.isSpectator ? "Playing" : "Hosting" }}
</li>
<li @click="leaveSession" v-if="grimoire.sessionId">
<em>{{ grimoire.sessionId }}</em>
@ -116,9 +116,7 @@ export default {
hostSession() {
const sessionId = prompt(
"Enter a code for your session",
Math.random()
.toString(36)
.substring(2, 7)
Math.round(Math.random() * 10000)
);
if (sessionId) {
this.$store.commit("setSpectator", false);

View File

@ -54,7 +54,12 @@ class LiveSession {
* @private
*/
_handleMessage({ data }) {
const [command, params] = JSON.parse(data);
let command, params;
try {
[command, params] = JSON.parse(data);
} catch (err) {
console.log("unsupported socket message", data);
}
switch (command) {
case "req":
if (params === "gs") {