docs: add documentation to AuthComponent and clean up component structure

This commit is contained in:
Chneemann 2025-04-27 21:07:41 +02:00
parent 3f135c9a1b
commit 8deb9c6bdb

View file

@ -31,12 +31,28 @@ import { LandingPageComponent } from './landing-page/landing-page.component';
export class AuthComponent implements OnInit { export class AuthComponent implements OnInit {
currentRoute: any; currentRoute: any;
/**
* Initializes the AuthComponent with the ActivatedRoute and ErrorService.
*/
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
public errorService: ErrorService public errorService: ErrorService
) {} ) {}
/**
* Angular lifecycle hook: Called once the component is initialized.
* It calls the subscribeToRoute method to update the currentRoute variable
* based on the route parameters.
*/
ngOnInit(): void { ngOnInit(): void {
this.subscribeToRoute();
}
/**
* Subscribe to the route parameter changes and update the currentRoute variable.
* This is needed to display the correct auth component based on the route.
*/
private subscribeToRoute(): void {
this.route.url.subscribe((url) => { this.route.url.subscribe((url) => {
this.currentRoute = url[0]?.path || ''; this.currentRoute = url[0]?.path || '';
}); });