mirror of https://github.com/bra1n/townsquare.git
small fixes
This commit is contained in:
parent
791c4b322f
commit
2ceee0421b
|
@ -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);
|
||||
|
|
|
@ -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") {
|
||||
|
|
Loading…
Reference in New Issue