diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.html b/apps/red-ui/src/app/components/notifications/notifications.component.html index 8c739086f..2726ea1c5 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.html +++ b/apps/red-ui/src/app/components/notifications/notifications.component.html @@ -13,7 +13,9 @@
{{ group.date }}
-
View all
+
+ View all +
{ $event.stopPropagation(); - const notifications = await this._notificationsService.getNotifications(false).toPromise(); - await this._readNotifications(notifications); + const notifications = this._notifications$.getValue(); + await this._notificationsService + .toggleNotificationRead( + notifications.map(n => n.id), + true, + ) + .toPromise(); await this._loadData(); } @@ -59,12 +64,6 @@ export class NotificationsComponent implements OnInit { await this._loadData(); } - private async _readNotifications(notifications: Notification[]): Promise { - for (const notification of notifications) { - await this._notificationsService.toggleNotificationRead([notification.id], true).toPromise(); - } - } - private async _loadData(): Promise { const notifications = await this._notificationsService.getNotifications(false).toPromise(); this._notifications$.next(notifications);