2022-03-29 21:55:47 +02:00
|
|
|
import { Component, OnDestroy } from "@angular/core";
|
|
|
|
import { NavigationEnd, Router } from "@angular/router";
|
|
|
|
import { Subscription } from "rxjs";
|
|
|
|
import { filter } from "rxjs/operators";
|
|
|
|
|
|
|
|
@Component({
|
2022-08-03 21:40:04 +02:00
|
|
|
selector: "app-reports-layout",
|
|
|
|
templateUrl: "reports-layout.component.html",
|
2022-03-29 21:55:47 +02:00
|
|
|
})
|
2022-08-03 21:40:04 +02:00
|
|
|
export class ReportsLayoutComponent implements OnDestroy {
|
2022-03-29 21:55:47 +02:00
|
|
|
homepage = true;
|
|
|
|
subscription: Subscription;
|
|
|
|
|
|
|
|
constructor(router: Router) {
|
|
|
|
this.subscription = router.events
|
|
|
|
.pipe(filter((event) => event instanceof NavigationEnd))
|
2022-08-26 18:09:28 +02:00
|
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
2022-03-29 21:55:47 +02:00
|
|
|
.subscribe((event) => {
|
|
|
|
this.homepage = (event as NavigationEnd).url == "/reports";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
this.subscription?.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|