diff --git a/apps/red-ui/src/app/notification/notification.service.ts b/apps/red-ui/src/app/notification/notification.service.ts index 319c1d1ff..edf75d17a 100644 --- a/apps/red-ui/src/app/notification/notification.service.ts +++ b/apps/red-ui/src/app/notification/notification.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { ActiveToast, ToastrService } from 'ngx-toastr'; import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config'; +import { NavigationStart, Router } from '@angular/router'; export enum NotificationType { SUCCESS = 'SUCCESS', @@ -19,7 +20,17 @@ export class Action { providedIn: 'root' }) export class NotificationService { - constructor(private readonly _snackBar: MatSnackBar, private readonly _toastr: ToastrService) {} + constructor( + private readonly _snackBar: MatSnackBar, + private readonly _toastr: ToastrService, + private readonly _router: Router + ) { + _router.events.subscribe((event) => { + if (event instanceof NavigationStart) { + this._toastr.clear(); + } + }); + } showToastNotification( message: string,