Browse Source

fix(client): resolve type errors

pull/7080/head
KenTandrian 4 weeks ago
parent
commit
f159c7ba5f
  1. 28
      apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

28
apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

@ -64,11 +64,17 @@ export class GfTransferBalanceDialogComponent {
} }
); );
this.transferBalanceForm.get('fromAccount').valueChanges.subscribe((id) => { this.transferBalanceForm
this.currency = this.accounts.find((account) => { .get('fromAccount')
return account.id === id; ?.valueChanges.subscribe((id) => {
}).currency; const currency = this.accounts.find((account) => {
}); return account.id === id;
})?.currency;
if (currency) {
this.currency = currency;
}
});
} }
public onCancel() { public onCancel() {
@ -77,20 +83,22 @@ export class GfTransferBalanceDialogComponent {
public onSubmit() { public onSubmit() {
const account: TransferBalanceDto = { const account: TransferBalanceDto = {
accountIdFrom: this.transferBalanceForm.get('fromAccount').value, accountIdFrom: this.transferBalanceForm.get('fromAccount')?.value,
accountIdTo: this.transferBalanceForm.get('toAccount').value, accountIdTo: this.transferBalanceForm.get('toAccount')?.value,
balance: this.transferBalanceForm.get('balance').value balance: this.transferBalanceForm.get('balance')?.value
}; };
this.dialogRef.close({ account }); this.dialogRef.close({ account });
} }
private compareAccounts(control: AbstractControl): ValidationErrors { private compareAccounts(control: AbstractControl): ValidationErrors | null {
const accountFrom = control.get('fromAccount'); const accountFrom = control.get('fromAccount');
const accountTo = control.get('toAccount'); const accountTo = control.get('toAccount');
if (accountFrom.value === accountTo.value) { if (accountFrom?.value === accountTo?.value) {
return { invalid: true }; return { invalid: true };
} }
return null;
} }
} }

Loading…
Cancel
Save