docs: add documentation to AuthComponent and clean up component structure
This commit is contained in:
parent
3f135c9a1b
commit
8deb9c6bdb
1 changed files with 16 additions and 0 deletions
|
|
@ -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 || '';
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue