diff --git a/frontend/src/app/components/toast/toast.component.ts b/frontend/src/app/components/toast/toast.component.ts index 69885e13..d7717daf 100644 --- a/frontend/src/app/components/toast/toast.component.ts +++ b/frontend/src/app/components/toast/toast.component.ts @@ -11,33 +11,13 @@ import {NavigationEnd, Router} from '@angular/router'; styleUrls: ['./toast.component.scss'] }) export class ToastComponent implements OnInit { - routerSubscription: Subscription | undefined; constructor( - public router: Router, public toastService: ToastService, - public authService: AuthService, - public fastenApiService: FastenApiService, ) {} ngOnInit(): void { } - ngAfterViewInit() { - //TODO: this is a bit kludgey. - // Ideally we want consistently listen to events, but only when the user is authenticated. - this.routerSubscription = this.router.events.subscribe((event) => { - if (event instanceof NavigationEnd) { - if(!event.url.startsWith("/auth") && this.authService.IsAuthenticated()){ - console.log("user is authenticated, listening for notifications") - //user is authenticated, lets start listening for notifications - this.routerSubscription?.unsubscribe() - this.fastenApiService.listenEventBus().subscribe((event)=>{ - console.log("eventbus event:", event) - //TODO: start toasts. - }) - } - } - }); - } + }