Skip to content

Commit

Permalink
fix notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Sams, Roland authored and Sams, Roland committed Nov 29, 2024
1 parent a1dcdd3 commit b618795
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/app/services/user-notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,20 @@ export class UserNotificationService {
);
}

public updateUnreadNotifications(): void {
this.apiService.getUnreadNotifications().subscribe((notifications) => {
this._userNotifications.next(notifications);
});
}

public addNotification(notification: UserNotification): void {
this.insertNotification(notification);
}
public markAllAsRead(): void {
this.apiService.markAllAsRead().subscribe();
public updateUnreadNotifications(): void {
this.apiService.getUnreadNotifications().subscribe((notifications) => {
this._userNotifications.next(notifications);
});
}

public addNotification(notification: UserNotification): void {
this.insertNotification(notification);
}

public markAllAsRead(): void {
this.apiService.markAllAsRead().subscribe();
}

private insertNotification(notification: UserNotification): void {
if (notification.created_at == null) {
notification.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
Expand All @@ -78,7 +75,8 @@ export class UserNotificationService {
}

private markAsRead(notification: UserNotification): void {
if (notification.type === UserNotificationType.SwUpdate || notification.type === UserNotificationType.TestSocket) {
if (notification.type === UserNotificationType.SwUpdate
|| notification.type === UserNotificationType.TestSocket) {
this.removeNotification(notification);
return;
}
Expand Down

0 comments on commit b618795

Please sign in to comment.