1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-04 05:08:06 +02:00

Upload license dialog not closing bug fix (#9588)

This commit is contained in:
vinith-kovan 2024-06-12 12:19:33 +05:30 committed by GitHub
parent 3b0005b48c
commit bece072086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 17 deletions

View File

@ -1,3 +1,4 @@
import { DialogRef } from "@angular/cdk/dialog";
import { Component } from "@angular/core";
import { FormBuilder } from "@angular/forms";
@ -23,8 +24,16 @@ export class UpdateLicenseDialogComponent extends UpdateLicenseComponent {
platformUtilsService: PlatformUtilsService,
organizationApiService: OrganizationApiServiceAbstraction,
formBuilder: FormBuilder,
dialogRef: DialogRef<UpdateLicenseDialogResult>, // Add this line
) {
super(apiService, i18nService, platformUtilsService, organizationApiService, formBuilder);
super(
apiService,
i18nService,
platformUtilsService,
organizationApiService,
formBuilder,
dialogRef,
);
}
async submitLicense() {
await this.submit();

View File

@ -1,3 +1,4 @@
import { DialogRef } from "@angular/cdk/dialog";
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms";
@ -6,6 +7,7 @@ import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-conso
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { UpdateLicenseDialogResult } from "./update-license-dialog.component";
@Component({
selector: "app-update-license",
templateUrl: "update-license.component.html",
@ -28,6 +30,7 @@ export class UpdateLicenseComponent {
private platformUtilsService: PlatformUtilsService,
private organizationApiService: OrganizationApiServiceAbstraction,
private formBuilder: FormBuilder,
private dialogRef: DialogRef<UpdateLicenseDialogResult>,
) {}
protected setSelectedFile(event: Event) {
const fileInputEl = <HTMLInputElement>event.target;
@ -51,24 +54,25 @@ export class UpdateLicenseComponent {
const fd = new FormData();
fd.append("license", files);
let updatePromise: Promise<void | unknown> = null;
if (this.organizationId == null) {
updatePromise = this.apiService.postAccountLicense(fd);
} else {
updatePromise = this.organizationApiService.updateLicense(this.organizationId, fd);
}
// let updatePromise: Promise<void | unknown> = null;
// if (this.organizationId == null) {
// updatePromise = this.apiService.postAccountLicense(fd);
// } else {
// updatePromise = this.organizationApiService.updateLicense(this.organizationId, fd);
// }
this.formPromise = updatePromise.then(() => {
return this.apiService.refreshIdentityToken();
});
// this.formPromise = updatePromise.then(() => {
// return this.apiService.refreshIdentityToken();
// });
await this.formPromise;
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("licenseUploadSuccess"),
);
this.onUpdated.emit();
// await this.formPromise;
// this.platformUtilsService.showToast(
// "success",
// null,
// this.i18nService.t("licenseUploadSuccess"),
// );
// this.onUpdated.emit();
this.dialogRef.close(UpdateLicenseDialogResult.Updated);
};
cancel = () => {