From 2b0a1e0d6d85cc83339529086335d34b20a2360c Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 9 Sep 2023 18:58:20 -0700 Subject: [PATCH] working updates. --- .../app/components/toast/toast.component.ts | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) 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. - }) - } - } - }); - } + }