1 |
52006
|
myrto.kouk
|
/*
|
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 { Http, Headers, RequestOptions, Response } from '@angular/http';
|
10 |
|
|
import { ReportResponseWrapper } from '../domain/usageStatsClasses';
|
11 |
52768
|
myrto.kouk
|
import {HttpClient, HttpHeaders} from "@angular/common/http";
|
12 |
52006
|
myrto.kouk
|
|
13 |
|
|
|
14 |
|
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
15 |
|
|
const httpOptions = new RequestOptions({ headers: headers });
|
16 |
52768
|
myrto.kouk
|
const headerOptions = {
|
17 |
|
|
headers : new HttpHeaders().set('Content-Type', 'application/json')
|
18 |
|
|
.set('Accept', 'application/json'),
|
19 |
|
|
withCredentials: true
|
20 |
|
|
};
|
21 |
52006
|
myrto.kouk
|
|
22 |
|
|
@Injectable ()
|
23 |
|
|
export class UsagestatsService {
|
24 |
52995
|
myrto.kouk
|
private apiUrl = process.env.API_ENDPOINT + '/sushilite/';
|
25 |
52006
|
myrto.kouk
|
|
26 |
52995
|
myrto.kouk
|
constructor(private httpClient: HttpClient) { }
|
27 |
52006
|
myrto.kouk
|
|
28 |
|
|
|
29 |
52995
|
myrto.kouk
|
getReportResponse(page: String, pageSize: String, params: URLSearchParams): Observable<ReportResponseWrapper> {
|
30 |
|
|
let url = `${this.apiUrl}getReportResults/${page}/${pageSize}?${params}`;
|
31 |
52006
|
myrto.kouk
|
console.log(`knocking on: ${url}`);
|
32 |
|
|
|
33 |
52768
|
myrto.kouk
|
return this.httpClient.get<ReportResponseWrapper>(url, headerOptions);
|
34 |
52006
|
myrto.kouk
|
}
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
}
|