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:
parent
5057294c0e
commit
9d7bd8c893
2 changed files with 13 additions and 11 deletions
|
|
@ -62,17 +62,6 @@ export default {
|
|||
*/
|
||||
this.objects = data.objects;
|
||||
},
|
||||
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);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getObjects();
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue