1
|
/*
|
2
|
* Created by myrto on 05/11/2018
|
3
|
*/
|
4
|
|
5
|
|
6
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
7
|
import { Injectable } from '@angular/core';
|
8
|
import { Observable } from 'rxjs';
|
9
|
import { UsageStatsSummary } from '../domain/typeScriptClasses';
|
10
|
import { environment } from '../../environments/environment';
|
11
|
|
12
|
const headerOptions = {
|
13
|
headers : new HttpHeaders().set('Content-Type', 'application/json').set('Accept', 'application/json'),
|
14
|
withCredentials: true
|
15
|
};
|
16
|
|
17
|
@Injectable ()
|
18
|
export class StatisticsService {
|
19
|
private apiUrl = environment.API_ENDPOINT + '/stats/';
|
20
|
|
21
|
constructor(private httpClient: HttpClient) { }
|
22
|
|
23
|
|
24
|
getStatisticsNumbers(): Observable<UsageStatsSummary> {
|
25
|
const url = `${this.apiUrl}getStatistics`;
|
26
|
console.log(`knocking on: ${url}`);
|
27
|
|
28
|
return this.httpClient.get<UsageStatsSummary>(url, headerOptions);
|
29
|
}
|
30
|
|
31
|
|
32
|
}
|