merge
This commit is contained in:
parent
07ba80542e
commit
ceea5f42f8
1 changed files with 25 additions and 0 deletions
|
@ -72,6 +72,31 @@ const noteUpdated = (item, note) => {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const connection = stream.useChannel('main');
|
const connection = stream.useChannel('main');
|
||||||
connection.on('notification', onNotification);
|
connection.on('notification', onNotification);
|
||||||
|
connection.on('readAllNotifications', () => {
|
||||||
|
if (pagingComponent.value) {
|
||||||
|
for (const item of pagingComponent.value.queue) {
|
||||||
|
item.isRead = true;
|
||||||
|
}
|
||||||
|
for (const item of pagingComponent.value.items) {
|
||||||
|
item.isRead = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connection.on('readNotifications', notificationIds => {
|
||||||
|
if (pagingComponent.value) {
|
||||||
|
for (let i = 0; i < pagingComponent.value.queue.length; i++) {
|
||||||
|
if (notificationIds.includes(pagingComponent.value.queue[i].id)) {
|
||||||
|
pagingComponent.value.queue[i].isRead = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < (pagingComponent.value.items || []).length; i++) {
|
||||||
|
if (notificationIds.includes(pagingComponent.value.items[i].id)) {
|
||||||
|
pagingComponent.value.items[i].isRead = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
connection.dispose();
|
connection.dispose();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue