1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-27 04:03:00 +02:00

[PM-7004] Delete formGroup initialization in verify-recover-delete-org.component.ts

This commit is contained in:
Rui Tome 2024-04-19 14:35:33 +01:00
parent 392fdb8a14
commit 0b191a27dd
No known key found for this signature in database
GPG Key ID: 526239D96A8EC066
2 changed files with 35 additions and 41 deletions

View File

@ -1,6 +1,5 @@
<form [formGroup]="formGroup" [bitSubmit]="submit"> <div class="row justify-content-md-center mt-5">
<div class="row justify-content-md-center mt-5"> <div class="col-3">
<div class="col-4">
<p class="lead text-center mb-4">{{ "deleteOrganization" | i18n }}</p> <p class="lead text-center mb-4">{{ "deleteOrganization" | i18n }}</p>
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -17,9 +16,9 @@
<button <button
type="submit" type="submit"
bitButton bitButton
bitFormButton
buttonType="primary" buttonType="primary"
class="btn btn-danger btn-block btn-submit" class="btn btn-danger btn-block btn-submit"
[bitAction]="submit"
[disabled]="loading" [disabled]="loading"
> >
<span>{{ "deleteOrganization" | i18n }}</span> <span>{{ "deleteOrganization" | i18n }}</span>
@ -31,5 +30,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form>

View File

@ -1,5 +1,4 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom } from "rxjs"; import { firstValueFrom } from "rxjs";
@ -20,7 +19,8 @@ export class VerifyRecoverDeleteOrgComponent implements OnInit {
loading = true; loading = true;
name: string; name: string;
protected formGroup: FormGroup; private orgId: string;
private token: string;
constructor( constructor(
private router: Router, private router: Router,
@ -29,16 +29,13 @@ export class VerifyRecoverDeleteOrgComponent implements OnInit {
private i18nService: I18nService, private i18nService: I18nService,
private route: ActivatedRoute, private route: ActivatedRoute,
private logService: LogService, private logService: LogService,
private formBuilder: FormBuilder,
) {} ) {}
async ngOnInit() { async ngOnInit() {
const qParams = await firstValueFrom(this.route.queryParams); const qParams = await firstValueFrom(this.route.queryParams);
if (qParams.orgId != null && qParams.token != null && qParams.name != null) { if (qParams.orgId != null && qParams.token != null && qParams.name != null) {
this.formGroup = this.formBuilder.group({ this.orgId = qParams.orgId;
orgId: [qParams.orgId], this.token = qParams.token;
token: [qParams.token],
});
this.name = qParams.name; this.name = qParams.name;
this.loading = false; this.loading = false;
} else { } else {
@ -48,9 +45,8 @@ export class VerifyRecoverDeleteOrgComponent implements OnInit {
submit = async () => { submit = async () => {
try { try {
const { orgId, token } = this.formGroup.value; const request = new OrganizationVerifyDeleteRecoverRequest(this.token);
const request = new OrganizationVerifyDeleteRecoverRequest(token); await this.apiService.deleteUsingToken(this.orgId, request);
await this.apiService.deleteUsingToken(orgId, request);
this.platformUtilsService.showToast( this.platformUtilsService.showToast(
"success", "success",
this.i18nService.t("organizationDeleted"), this.i18nService.t("organizationDeleted"),