0
0
Fork 0

Move ChosenObject listener from the ChooseObject component to the InGame component so that the guessers also have a listener for the event data.

This commit is contained in:
Oliver-Akins 2021-01-09 01:25:31 -07:00
parent 5057294c0e
commit 9d7bd8c893
2 changed files with 13 additions and 11 deletions

View file

@ -48,6 +48,19 @@ export default {
},
},
methods: {},
sockets: {
ChosenObject(data) {
/**
* Sent to all clients so that they can set their store data and in
* turn stay synchronized on what object they are trying to get
* their teammate to guess.
*/
if (data.status < 200 || 300 <= data.status) {
this.$emit(`error`, data);
};
this.$store.commit(`setObject`, data.choice);
},
}
}
</script>