diff --git a/src/app/view/home/latestblocks/latestblocks.component.ts b/src/app/view/home/latestblocks/latestblocks.component.ts index 7e407df..91de02a 100644 --- a/src/app/view/home/latestblocks/latestblocks.component.ts +++ b/src/app/view/home/latestblocks/latestblocks.component.ts @@ -1,9 +1,10 @@ import { Component, OnInit } from '@angular/core'; -import { HttpParams } from '@angular/common/http'; +import { HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http'; import { ChartService } from '../../../shared/services/chart.service'; import { FormGroup, FormControl } from '@angular/forms'; - import { TransServiceService } from '../../../shared/services/trans-service.service'; +import { map, catchError } from 'rxjs/operators'; +import { throwError} from 'rxjs'; @Component({ selector: 'epic-explorer-latestblocks', @@ -20,9 +21,10 @@ export class LatestblocksComponent implements OnInit { pagesize: new FormControl(20), }); - constructor(private chartService: ChartService,public translate: TransServiceService) {} + constructor(private chartService: ChartService,public translate: TransServiceService,public http: HttpClient) {} ngOnInit() { + this. getpeersList(); this.gettinghashList(1, 20); } @@ -41,6 +43,20 @@ export class LatestblocksComponent implements OnInit { ); } + public getpeersList() { + console.log('EEE'); + this.http + .get('http://5.9.174.122:3413/v1/peers/connected') + .pipe( + map(res => { + console.log('reeeee',res); + }), + catchError((error: HttpErrorResponse): any => throwError(error)), + ); + } + + + public onClickPlus(height) { // this.beforeClick = true; this.clickValue = 'hash_' + height;