From ab4cb599754c669f7bcd7e97267ed7e640b68e10 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Tue, 13 Jul 2021 19:13:48 +0300 Subject: [PATCH] Add token balance after response from worker. --- src/app/_services/user.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 8cb1963..3b161fb 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -211,6 +211,13 @@ export class UserService { if (typeof Worker !== 'undefined') { const worker = new Worker('@app/_workers/fetch-accounts.worker', { type: 'module' }); worker.onmessage = ({ data }) => { + this.tokenService.load.subscribe(async (status: boolean) => { + if (status) { + data.balance = await this.tokenService.getTokenBalance( + data.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0] + ); + } + }); this.addAccount(data, limit); }; worker.postMessage({