Move where the sockets listener is.

This commit is contained in:
Oliver-Akins 2020-09-27 22:02:23 -06:00
parent 3683ee09a2
commit 76385d1f69

View file

@ -19,18 +19,6 @@ export default {
name: 'JoinHost', name: 'JoinHost',
components: {}, components: {},
data() {return {}}, data() {return {}},
sockets: {
HostInformation(data) {
console.log(data)
if (data.success) {
sessionStorage.setItem(`game-code`, data.game_code);
this.$emit(`is-host`, true);
this.$emit(`go-to`, `lobby`);
} else {
this.error = data.error_message
};
}
},
methods: { methods: {
host_game() { host_game() {
let username = ``; let username = ``;
@ -46,9 +34,21 @@ export default {
}); });
}, },
join_game() { join_game() {
this.$emit(`go-to`, ``) this.$emit(`go-to`, `game-code`)
}, },
}, },
sockets: {
HostInformation(data) {
if (data.success) {
sessionStorage.setItem(`game-code`, data.game_code);
this.$emit(`is-host`, true);
// this.$emit(`go-to`, `lobby`);
this.$store.state.state = `lobby`;
} else {
this.error = data.error_message
};
}
},
} }
</script> </script>