Add type to token service load subject.

This commit is contained in:
Spencer Ofwiti 2021-06-09 18:52:59 +03:00
parent 71fc96bfe1
commit 9439e25370
5 changed files with 15 additions and 11 deletions

View File

@ -201,11 +201,13 @@ export class UserService {
const account: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap(); const account: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
const accountInfo = account.m.data; const accountInfo = account.m.data;
await personValidation(accountInfo); await personValidation(accountInfo);
this.tokenService.onload = async (status: boolean): Promise<void> => { this.tokenService.load.subscribe(async (status: boolean) => {
accountInfo.balance = await this.tokenService.getTokenBalance( if (status) {
accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0] accountInfo.balance = await this.tokenService.getTokenBalance(
); accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
}; );
}
});
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard)); accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
await vcardValidation(accountInfo.vcard); await vcardValidation(accountInfo.vcard);
this.addAccount(accountInfo, limit); this.addAccount(accountInfo, limit);

View File

@ -190,7 +190,7 @@ export class AccountDetailsComponent implements OnInit {
.getGenders() .getGenders()
.pipe(first()) .pipe(first())
.subscribe((res) => (this.genders = res)); .subscribe((res) => (this.genders = res));
this.tokenService.load.subscribe(async (status) => { this.tokenService.load.subscribe(async (status: boolean) => {
if (status) { if (status) {
this.tokenSymbol = await this.tokenService.getTokenSymbol(); this.tokenSymbol = await this.tokenService.getTokenSymbol();
} }

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) => {
await this.tokenService.getTokens(); if (status) {
}; 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);

View File

@ -48,7 +48,7 @@ export class TransactionDetailsComponent implements OnInit {
this.recipientBloxbergLink = this.recipientBloxbergLink =
'https://blockexplorer.bloxberg.org/address/' + this.transaction?.to + '/transactions'; 'https://blockexplorer.bloxberg.org/address/' + this.transaction?.to + '/transactions';
} }
this.tokenService.load.subscribe(async (status) => { this.tokenService.load.subscribe(async (status: boolean) => {
if (status) { if (status) {
this.tokenSymbol = await this.tokenService.getTokenSymbol(); this.tokenSymbol = await this.tokenService.getTokenSymbol();
this.tokenName = await this.tokenService.getTokenName(); this.tokenName = await this.tokenService.getTokenName();

View File

@ -56,7 +56,7 @@ export class TransactionsComponent implements OnInit, AfterViewInit {
.getTransactionTypes() .getTransactionTypes()
.pipe(first()) .pipe(first())
.subscribe((res) => (this.transactionsTypes = res)); .subscribe((res) => (this.transactionsTypes = res));
this.tokenService.load.subscribe(async (status) => { this.tokenService.load.subscribe(async (status: boolean) => {
if (status) { if (status) {
this.tokenSymbol = await this.tokenService.getTokenSymbol(); this.tokenSymbol = await this.tokenService.getTokenSymbol();
} }