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>
|
||||||
<li class="headline" v-if="grimoire.sessionId">
|
<li class="headline" v-if="grimoire.sessionId">
|
||||||
<font-awesome-icon icon="broadcast-tower" />
|
<font-awesome-icon icon="broadcast-tower" />
|
||||||
{{ grimoire.isSpectator ? "Spectating" : "Hosting" }}
|
{{ grimoire.isSpectator ? "Playing" : "Hosting" }}
|
||||||
</li>
|
</li>
|
||||||
<li @click="leaveSession" v-if="grimoire.sessionId">
|
<li @click="leaveSession" v-if="grimoire.sessionId">
|
||||||
<em>{{ grimoire.sessionId }}</em>
|
<em>{{ grimoire.sessionId }}</em>
|
||||||
|
@ -116,9 +116,7 @@ export default {
|
||||||
hostSession() {
|
hostSession() {
|
||||||
const sessionId = prompt(
|
const sessionId = prompt(
|
||||||
"Enter a code for your session",
|
"Enter a code for your session",
|
||||||
Math.random()
|
Math.round(Math.random() * 10000)
|
||||||
.toString(36)
|
|
||||||
.substring(2, 7)
|
|
||||||
);
|
);
|
||||||
if (sessionId) {
|
if (sessionId) {
|
||||||
this.$store.commit("setSpectator", false);
|
this.$store.commit("setSpectator", false);
|
||||||
|
|
|
@ -54,7 +54,12 @@ class LiveSession {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_handleMessage({ data }) {
|
_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) {
|
switch (command) {
|
||||||
case "req":
|
case "req":
|
||||||
if (params === "gs") {
|
if (params === "gs") {
|
||||||
|
|
Loading…
Reference in New Issue