Alexis Hernandez
7 years ago
3 changed files with 32 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||||
|
|
||||
|
export class ServerStats { |
||||
|
totalSupply: number; |
||||
|
transactions: number; |
||||
|
height: number; |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
import { Injectable } from '@angular/core'; |
||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http'; |
||||
|
import { Observable } from 'rxjs/Observable'; |
||||
|
|
||||
|
import { environment } from '../../environments/environment'; |
||||
|
|
||||
|
import { ServerStats } from '../models/ticker'; |
||||
|
|
||||
|
const httpOptions = { |
||||
|
headers: new HttpHeaders({ 'Content-Type': 'application/json' }) |
||||
|
}; |
||||
|
|
||||
|
@Injectable() |
||||
|
export class TickerService { |
||||
|
|
||||
|
private baseUrl = environment.api.url + '/stats'; |
||||
|
|
||||
|
constructor(private http: HttpClient) { } |
||||
|
|
||||
|
get(): Observable<ServerStats> { |
||||
|
const url = this.baseUrl; |
||||
|
return this.http.get<ServerStats>(url); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue