-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathappsNbeer.js
More file actions
49 lines (44 loc) · 1.42 KB
/
Copy pathappsNbeer.js
File metadata and controls
49 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//------------------ wap-form.vue ---------------------
function formSubmited() {
eventBus.emit('formSubmited', { ...this.userInfo })
const wap = this.$store.getters.editedWap
socketService.emit('formSubmited', {
...this.userInfo,
wapOwnerId: wap.owner._id,
wapId: wap._id,
})
}
//------------------ published-wap.vue ------------------
async function addUserInfo(userInfo) {
if (userInfo.type === 'subscription')
this.wap.usersData.subscriptions.push(userInfo)
else this.wap.usersData.contacts.push(userInfo)
try {
await this.updateWap()
ElMessage({
message: 'Message sent successfully',
type: 'success',
})
} catch (error) {
ElMessage({
title: "Couldn't send message",
type: 'error',
})
}
}
//------------------ app-dashboard.vue --------------------
async function created() {
socketService.on('formSent', (sentMsg) => {
if (sentMsg.wapOwnerId === this.loggedinUser._id) {
const updatedWapData = this.userWaps.find(
(wap) => wap._id === sentMsg.wapId
)
const { wapOwnerId, wapId, ...newMsg } = sentMsg
updatedWapData.usersData.subscriptions.unshift(newMsg)
}
ElMessage({
message: `You have a new lead from site '${sentMsg.wapName}''`,
type: 'success',
})
})
}