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 accountInfo = account.m.data;
await personValidation(accountInfo);
this.tokenService.onload = async (status: boolean): Promise<void> => {
accountInfo.balance = await this.tokenService.getTokenBalance(
accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
);
};
this.tokenService.load.subscribe(async (status: boolean) => {
if (status) {
accountInfo.balance = await this.tokenService.getTokenBalance(
accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
);
}
});
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
await vcardValidation(accountInfo.vcard);
this.addAccount(accountInfo, limit);

View File

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

View File

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

View File

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

View File

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