Browse Source

feat(client): enforce immutability

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

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

@ -42,23 +42,14 @@ import {
templateUrl: 'transfer-balance-dialog.html' templateUrl: 'transfer-balance-dialog.html'
}) })
export class GfTransferBalanceDialogComponent { export class GfTransferBalanceDialogComponent {
protected accounts: Account[] = []; protected readonly accounts: Account[] =
protected currency: string; inject<TransferBalanceDialogParams>(MAT_DIALOG_DATA).accounts;
protected transferBalanceForm: TransferBalanceForm;
private readonly data = inject<TransferBalanceDialogParams>(MAT_DIALOG_DATA); protected currency: string;
private readonly dialogRef =
inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef);
public ngOnInit() {
this.accounts = this.data.accounts;
this.transferBalanceForm = new FormGroup( protected readonly transferBalanceForm: TransferBalanceForm = new FormGroup(
{ {
balance: new FormControl<number | string | null>( balance: new FormControl<number | string | null>('', Validators.required),
'',
Validators.required
),
fromAccount: new FormControl<string | null>('', Validators.required), fromAccount: new FormControl<string | null>('', Validators.required),
toAccount: new FormControl<string | null>('', Validators.required) toAccount: new FormControl<string | null>('', Validators.required)
}, },
@ -67,6 +58,10 @@ export class GfTransferBalanceDialogComponent {
} }
); );
private readonly dialogRef =
inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef);
public ngOnInit() {
this.transferBalanceForm.controls.fromAccount.valueChanges.subscribe( this.transferBalanceForm.controls.fromAccount.valueChanges.subscribe(
(id) => { (id) => {
const currency = this.accounts.find((account) => { const currency = this.accounts.find((account) => {

Loading…
Cancel
Save