PM-4978 Addressed review comments

This commit is contained in:
KiruthigaManivannan 2024-05-17 16:25:05 +05:30
parent 97a069affb
commit c27f5b7337
2 changed files with 8 additions and 21 deletions

View File

@ -11,11 +11,11 @@
<div class="tw-col-span-6">
<bit-form-field>
<bit-label>{{ "name" | i18n }}</bit-label>
<input bitInput type="text" formControlName="name" />
<input bitInput formControlName="name" />
</bit-form-field>
<bit-form-field>
<bit-label>{{ "email" | i18n }}</bit-label>
<input bitInput type="text" formControlName="email" readonly />
<input bitInput formControlName="email" readonly />
</bit-form-field>
</div>
<div class="tw-col-span-6">

View File

@ -42,8 +42,8 @@ export class ProfileComponent implements OnInit, OnDestroy {
this.profile = await this.apiService.getProfile();
this.loading = false;
this.fingerprintMaterial = await this.stateService.getUserId();
this.name = this.profile.name;
this.email = this.profile.email;
this.formGroup.get("name").setValue(this.profile.name);
this.formGroup.get("email").setValue(this.profile.email);
this.formGroup
.get("name")
@ -58,22 +58,6 @@ export class ProfileComponent implements OnInit, OnDestroy {
this.destroy$.complete();
}
get name(): string {
return this.formGroup.value.name;
}
set name(profileName: string) {
this.formGroup.get("name").setValue(profileName);
}
get email(): string {
return this.formGroup.value.email;
}
set email(profileEmail: string) {
this.formGroup.get("email").setValue(profileEmail);
}
openChangeAvatar = async () => {
const modalOpened = await this.modalService.openViewRef(
ChangeAvatarComponent,
@ -88,7 +72,10 @@ export class ProfileComponent implements OnInit, OnDestroy {
};
submit = async () => {
const request = new UpdateProfileRequest(this.name, this.profile.masterPasswordHint);
const request = new UpdateProfileRequest(
this.formGroup.get("name").value,
this.profile.masterPasswordHint,
);
await this.apiService.putProfile(request);
this.platformUtilsService.showToast("success", null, this.i18nService.t("accountUpdated"));
};