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