From 8deb9c6bdb89cdd5acdbc23ec2f04b2a0df7c19b Mon Sep 17 00:00:00 2001 From: Chneemann Date: Sun, 27 Apr 2025 21:07:41 +0200 Subject: [PATCH] docs: add documentation to AuthComponent and clean up component structure --- .../src/app/components/auth/auth.component.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/app/components/auth/auth.component.ts b/frontend/src/app/components/auth/auth.component.ts index bd2d304..13873d7 100644 --- a/frontend/src/app/components/auth/auth.component.ts +++ b/frontend/src/app/components/auth/auth.component.ts @@ -31,12 +31,28 @@ import { LandingPageComponent } from './landing-page/landing-page.component'; export class AuthComponent implements OnInit { currentRoute: any; + /** + * Initializes the AuthComponent with the ActivatedRoute and ErrorService. + */ constructor( private route: ActivatedRoute, 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 { + 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.currentRoute = url[0]?.path || ''; });