mempool/frontend/src/app/assets/assets.component.ts
softsimon 20c7ee98e7
Asset tracking.
Asset caching.
refs #37
2020-05-05 15:26:23 +07:00

46 lines
1.1 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { AssetsService } from '../services/assets.service';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-assets',
templateUrl: './assets.component.html',
styleUrls: ['./assets.component.scss']
})
export class AssetsComponent implements OnInit {
nativeAssetId = environment.nativeAssetId;
isLoading = true;
error: any;
assets: any;
constructor(
private assetsService: AssetsService,
) { }
ngOnInit() {
setTimeout(() => this.getAssets());
}
getAssets() {
this.assetsService.getAssetsJson$
.subscribe((assets) => {
this.assets = Object.values(assets);
this.assets.push({
name: 'Liquid Bitcoin',
ticker: 'L-BTC',
asset_id: this.nativeAssetId,
});
this.assets = this.assets.sort((a: any, b: any) => a.name.localeCompare(b.name));
this.isLoading = false;
},
(error) => {
console.log(error);
this.error = error;
this.isLoading = false;
});
}
}