Skip to content

Commit

Permalink
working updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Sep 10, 2023
1 parent 3c02bed commit 2b0a1e0
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions frontend/src/app/components/toast/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
})
}
}
});
}

}

0 comments on commit 2b0a1e0

Please # to comment.