|
@@ -68,7 +68,46 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(["user"])
|
|
|
|
|
|
+ ...mapState(["user", "meeting"])
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ meeting: {
|
|
|
|
+ handler(newVal, oldVal) {
|
|
|
|
+ if (oldVal && oldVal.uid) {
|
|
|
|
+ this.$socket.emit("meetingLeft", { lobby_uid: oldVal.lobby_uid, meeting_name: oldVal.name, meeting_uid: oldVal.uid, user: this.user });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (newVal && newVal.uid) {
|
|
|
|
+ this.$socket.emit("meetingJoined", { lobby_uid: newVal.lobby_uid, meeting_name: newVal.name, meeting_uid: newVal.uid, user: this.user });
|
|
|
|
+
|
|
|
|
+ /* axios
|
|
|
|
+ .get(`/meeting/${this.meeting.id}/messages`)
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.messages = response.data.map(cur => {
|
|
|
|
+ // cur.id = cur.message_id
|
|
|
|
+ cur.timestamp_formatted = timeago.format(cur.timestamp);
|
|
|
|
+
|
|
|
|
+ // cur.user = {
|
|
|
|
+ // name: cur.name,
|
|
|
|
+ // UID: cur.user_uid,
|
|
|
|
+ // avatarFile: cur.avatarSrc || null
|
|
|
|
+ // }
|
|
|
|
+ cur.sent = this.user.UID == cur.user.UID ? true : false;
|
|
|
|
+
|
|
|
|
+ // delete cur.message_id
|
|
|
|
+ // delete cur.name
|
|
|
|
+ // delete cur.user_uid
|
|
|
|
+
|
|
|
|
+ return cur;
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(e => {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }); */
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
sockets: {
|
|
sockets: {
|
|
incomingCall: function(data) {
|
|
incomingCall: function(data) {
|
|
@@ -90,6 +129,11 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 1000);
|
|
}, 1000);
|
|
|
|
+ },
|
|
|
|
+ reconnect: function() {
|
|
|
|
+ if (this.meeting.uid) {
|
|
|
|
+ this.$socket.emit("meetingJoined", { lobby_uid: this.meeting.lobby_uid, meeting_uid: this.meeting.uid, user: this.user });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -119,6 +163,10 @@ export default {
|
|
this.$store.commit("setLobbyActivity", meeting)
|
|
this.$store.commit("setLobbyActivity", meeting)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ this.sockets.subscribe("meeting-activity", data => {
|
|
|
|
+ this.$store.commit("setLobbyActivity", data)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|