Browse Source

web-ui: Add TickerService

scalafmt-draft
Alexis Hernandez 7 years ago
parent
commit
a720c57a26
  1. 2
      web-ui/src/app/app.module.ts
  2. 6
      web-ui/src/app/models/ticker.ts
  3. 24
      web-ui/src/app/services/ticker.service.ts

2
web-ui/src/app/app.module.ts

@ -18,6 +18,7 @@ import { ErrorService } from './services/error.service';
import { LanguageService } from './services/language.service'; import { LanguageService } from './services/language.service';
import { NavigatorService } from './services/navigator.service'; import { NavigatorService } from './services/navigator.service';
import { NotificationService } from './services/notification.service'; import { NotificationService } from './services/notification.service';
import { TickerService } from './services/ticker.service';
import { TransactionsService } from './services/transactions.service'; import { TransactionsService } from './services/transactions.service';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -66,6 +67,7 @@ import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.
LanguageService, LanguageService,
NavigatorService, NavigatorService,
NotificationService, NotificationService,
TickerService,
TransactionsService TransactionsService
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]

6
web-ui/src/app/models/ticker.ts

@ -0,0 +1,6 @@
export class ServerStats {
totalSupply: number;
transactions: number;
height: number;
}

24
web-ui/src/app/services/ticker.service.ts

@ -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…
Cancel
Save