docs: add JSDoc comments to EmailRequestComponent functions
This commit is contained in:
parent
14bb6c520c
commit
044ad477f2
1 changed files with 27 additions and 2 deletions
|
|
@ -22,16 +22,30 @@ export class EmailRequestComponent implements OnInit {
|
|||
|
||||
form: FormGroup = new FormGroup({});
|
||||
|
||||
/**
|
||||
* Initializes the EmailRequestComponent with FormBuilder, AuthService, and ErrorService.
|
||||
*/
|
||||
constructor(
|
||||
private errorService: ErrorService,
|
||||
private fb: FormBuilder,
|
||||
private authService: AuthService,
|
||||
private fb: FormBuilder
|
||||
private errorService: ErrorService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Lifecycle hook that initializes the component.
|
||||
* Initializes the form on component load.
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the form submission process.
|
||||
* Validates the form, sends a forgot-password request,
|
||||
* and emits a submission event on success.
|
||||
*
|
||||
* @returns A Promise that resolves when the process is complete.
|
||||
*/
|
||||
async onSubmit(): Promise<void> {
|
||||
if (this.form.valid) {
|
||||
const body = this.createFormRequestBody();
|
||||
|
|
@ -48,18 +62,29 @@ export class EmailRequestComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the reactive form with validators.
|
||||
*/
|
||||
private createForm(): void {
|
||||
this.form = this.fb.group({
|
||||
email: ['', [Validators.required, emailFormatValidator()]],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the request payload from the form values.
|
||||
*
|
||||
* @returns An object containing the normalized email address.
|
||||
*/
|
||||
private createFormRequestBody(): { email: string } {
|
||||
return {
|
||||
email: this.form.value.email.toLowerCase(),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits an event indicating that the form was successfully submitted.
|
||||
*/
|
||||
private emitFormSubmitted(): void {
|
||||
this.submittedChange.emit(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue