Add a handler for the state changes

This commit is contained in:
Oliver-Akins 2020-10-21 22:11:43 -06:00
parent 86acbe62e4
commit 7e2c53dfc4

View file

@ -15,17 +15,17 @@
/>
<Join-Or-Host
v-else-if="state == 'game-type'"
@go-to="state = $event"
@go-to="go_to"
@alert="alert = $event"
/>
<Game-Code
v-else-if="state == 'game-code'"
@go-to="state = $event"
@go-to="go_to"
@alert="alert = $event"
/>
<Game-Lobby
v-else-if="state == 'lobby'"
@go-to="state = $event"
@go-to="go_to"
@alert="alert = $event"
/>
</div>
@ -71,7 +71,19 @@ export default {
classes: []
},
}},
methods: {},
methods: {
go_to(state) {
if (this.alert.message) {
setTimeout(() => {
this.alert = {
message: ``,
classes: [],
};
}, 5000);
};
this.state = state;
},
},
sockets: {
disconnect() {
this.alert = {