Skip to content

Commit

Permalink
feat: #dev added blocking of duplicate same notification's message
Browse files Browse the repository at this point in the history
  • Loading branch information
pablitoo1 committed Dec 16, 2024
1 parent 4718701 commit 811779e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/shared/services/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ export class NotificationService {

public addNotification(message: string, duration?: number): void {
const notifications = this._notificationsSubject.getValue();

const existingNotification = notifications.find(
notification => notification.message === message
);

if (existingNotification) {
return;
}

const notification: INotification = {
id: this._notificationIdCounter++,
message,
Expand Down

0 comments on commit 811779e

Please sign in to comment.