Project

General

Profile

1
/*
2
* Created by myrto on 05/11/2018
3
*/
4

    
5

    
6
import { Injectable } from '@angular/core';
7
import { Observable } from 'rxjs/Observable';
8
import 'rxjs/add/operator/map';
9
import { ReportResponseWrapper } from '../domain/usageStatsClasses';
10
import {HttpClient, HttpHeaders} from "@angular/common/http";
11

    
12

    
13
const headerOptions = {
14
  headers : new HttpHeaders().set('Content-Type', 'application/json')
15
    .set('Accept', 'application/json'),
16
  withCredentials: true
17
};
18

    
19
@Injectable ()
20
export class StatisticsService {
21
  private apiUrl = process.env.API_ENDPOINT + '/stats/';
22

    
23
  constructor(private httpClient: HttpClient) { }
24

    
25

    
26
  getStatisticsNumbers(): Observable<Map<string,string>> {
27
    let url = `${this.apiUrl}getStatistics`;
28
    console.log(`knocking on: ${url}`);
29

    
30
    return this.httpClient.get<Map<string,string>>(url, headerOptions);
31
  }
32

    
33

    
34
}
(9-9/11)