Refactor loading of tokens in token component.

This commit is contained in:
Spencer Ofwiti 2021-06-11 11:29:55 +03:00
parent a2ee2ae071
commit 02b98a46ca

View File

@ -29,9 +29,11 @@ export class TokensComponent implements OnInit {
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
await this.tokenService.init(); await this.tokenService.init();
this.tokenService.onload = async (status: boolean): Promise<void> => { this.tokenService.load.subscribe(async (status: boolean) => {
if (status) {
await this.tokenService.getTokens(); await this.tokenService.getTokens();
}; }
});
this.tokenService.tokensSubject.subscribe((tokens) => { this.tokenService.tokensSubject.subscribe((tokens) => {
this.loggingService.sendInfoLevelMessage(tokens); this.loggingService.sendInfoLevelMessage(tokens);
this.dataSource = new MatTableDataSource(tokens); this.dataSource = new MatTableDataSource(tokens);