This commit is contained in:
2021-10-31 21:47:53 +01:00
parent 8c4dbe7d71
commit 2b883aee02
9 changed files with 101 additions and 8 deletions

View File

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { AccountService } from '../data-object-service';
import { Account } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { MessageService } from '../message.service';
@Component({
selector: 'app-ledger',
@ -7,9 +11,27 @@ import { Component, OnInit } from '@angular/core';
})
export class LedgerComponent implements OnInit {
constructor() { }
account: Account
accountId: number
ngOnInit(): void {
constructor(
private extApiService: ExtApiService,
private messageService: MessageService
) { }
async getAccount(): Promise<void> {
try {
this.messageService.add("Trying to load ledger account")
this.account = await this.extApiService.getAccountByDescription('Ledger')
this.messageService.add("Account loaded")
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
async ngOnInit(): Promise<void> {
await this.getAccount()
this.accountId = this.account.id
}
}