1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-26 13:13:22 +00:00
Files
browser/apps/web/src/app/auth/recover-delete.component.ts
Oscar Hinton ac49e594c1 Add standalone false to all non migrated (#14797)
Adds standalone: false to all components since Angular is changing the default to true and we'd rather not have the angular PR change 300+ files.
2025-05-15 10:44:07 -04:00

52 lines
1.6 KiB
TypeScript

// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component } from "@angular/core";
import { FormControl, FormGroup, Validators } from "@angular/forms";
import { Router } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { DeleteRecoverRequest } from "@bitwarden/common/models/request/delete-recover.request";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { ToastService } from "@bitwarden/components";
@Component({
selector: "app-recover-delete",
templateUrl: "recover-delete.component.html",
standalone: false,
})
export class RecoverDeleteComponent {
protected recoverDeleteForm = new FormGroup({
email: new FormControl("", [Validators.required]),
});
get email() {
return this.recoverDeleteForm.controls.email;
}
constructor(
private router: Router,
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private toastService: ToastService,
) {}
submit = async () => {
if (this.recoverDeleteForm.invalid) {
return;
}
const request = new DeleteRecoverRequest();
request.email = this.email.value.trim().toLowerCase();
await this.apiService.postAccountRecoverDelete(request);
this.toastService.showToast({
variant: "success",
title: null,
message: this.i18nService.t("deleteRecoverEmailSent"),
});
await this.router.navigate(["/"]);
};
}