initial release
This commit is contained in:
59
bizmatch/src/app/app.component.ts
Normal file
59
bizmatch/src/app/app.component.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||
import { HeaderComponent } from './components/header/header.component';
|
||||
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { LoadingService } from './services/loading.service';
|
||||
import { HomeComponent } from './pages/home/home.component';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { KeycloakService } from './services/keycloak.service';
|
||||
import { KeycloakEventType } from './models/keycloak-event';
|
||||
import { ListingCriteria, User } from './models/main.model';
|
||||
import { createGenericObject } from './utils/utils';
|
||||
import onChange from 'on-change';
|
||||
import { UserService } from './services/user.service';
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterOutlet, HeaderComponent, ProgressSpinnerModule, FooterComponent],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.scss'
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'bizmatch';
|
||||
actualRoute ='';
|
||||
user:User;
|
||||
listingCriteria:ListingCriteria = onChange(createGenericObject<ListingCriteria>(),(path, value, previousValue, applyData)=>{
|
||||
sessionStorage.setItem('criteria',JSON.stringify(value));
|
||||
});
|
||||
public constructor(public loadingService: LoadingService, private router: Router,private activatedRoute: ActivatedRoute, private keycloakService:KeycloakService,private userService:UserService) {
|
||||
this.router.events.pipe(
|
||||
filter(event => event instanceof NavigationEnd)
|
||||
).subscribe(() => {
|
||||
let currentRoute = this.activatedRoute.root;
|
||||
while (currentRoute.children[0] !== undefined) {
|
||||
currentRoute = currentRoute.children[0];
|
||||
}
|
||||
// Hier haben Sie Zugriff auf den aktuellen Route-Pfad
|
||||
this.actualRoute=currentRoute.snapshot.url[0].path
|
||||
});
|
||||
|
||||
// keycloakService.keycloakEvents$.subscribe({
|
||||
// next(event) {
|
||||
// if (event.type == KeycloakEventType.OnTokenExpired) {
|
||||
// keycloakService.updateToken(20);
|
||||
// }
|
||||
// if (event.type == KeycloakEventType.OnActionUpdate) {
|
||||
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
ngOnInit(){
|
||||
this.user = this.userService.getUser();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user