Move where the sockets listener is.
This commit is contained in:
parent
3683ee09a2
commit
76385d1f69
1 changed files with 13 additions and 13 deletions
|
|
@ -19,18 +19,6 @@ export default {
|
|||
name: 'JoinHost',
|
||||
components: {},
|
||||
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: {
|
||||
host_game() {
|
||||
let username = ``;
|
||||
|
|
@ -46,9 +34,21 @@ export default {
|
|||
});
|
||||
},
|
||||
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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue