ng-implementation/sae-csc/src/app/app.ts
2025-09-15 17:46:00 +02:00

39 lines
1.3 KiB
TypeScript

import {Component, inject, signal} from '@angular/core';
import {NavigationEnd, Router, RouterOutlet} from '@angular/router';
import {TopNavigation} from './shared/navigation/top-navigation/top-navigation';
import {FeedbackButton} from 'sae-lib/buttons/feedback-button/feedback-button';
import {filter} from 'rxjs/operators';
import {Store} from '@ngrx/store';
import {StateInterface} from './redux/reducers';
// import {SaeLib} from '@sae-lib/src/public-api';
@Component({
selector: 'app-root',
imports: [RouterOutlet, TopNavigation, FeedbackButton],
templateUrl: './app.html',
styleUrl: './app.scss'
})
export class App {
public router = inject(Router);
currentUrl: string = '';
public appState: any = {};
public user: any = {};
protected readonly title = signal('implem');
constructor(private store: Store<StateInterface>) {
this.store.select(state => state.app).subscribe(appState => {
this.appState = appState;
});
this.store.select(state => state.user).subscribe(user => {
this.user = user;
});
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
).subscribe((event: any) => {
this.currentUrl = event.urlAfterRedirects;
console.log('Current URL:', this.currentUrl);
});
}
}