diff options
Diffstat (limited to 'client/src/app/+admin/friends/shared')
-rw-r--r-- | client/src/app/+admin/friends/shared/friend.service.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts index 274373e3b..a32cdcc88 100644 --- a/client/src/app/+admin/friends/shared/friend.service.ts +++ b/client/src/app/+admin/friends/shared/friend.service.ts | |||
@@ -1,9 +1,12 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { HttpClient } from '@angular/common/http' | 2 | import { HttpClient, HttpParams } from '@angular/common/http' |
3 | import { Observable } from 'rxjs/Observable' | ||
3 | import 'rxjs/add/operator/catch' | 4 | import 'rxjs/add/operator/catch' |
4 | import 'rxjs/add/operator/map' | 5 | import 'rxjs/add/operator/map' |
5 | 6 | ||
6 | import { RestExtractor } from '../../../shared' | 7 | import { SortMeta } from 'primeng/primeng' |
8 | |||
9 | import { RestExtractor, RestPagination, RestService } from '../../../shared' | ||
7 | import { Pod, ResultList } from '../../../../../../shared' | 10 | import { Pod, ResultList } from '../../../../../../shared' |
8 | 11 | ||
9 | @Injectable() | 12 | @Injectable() |
@@ -12,11 +15,15 @@ export class FriendService { | |||
12 | 15 | ||
13 | constructor ( | 16 | constructor ( |
14 | private authHttp: HttpClient, | 17 | private authHttp: HttpClient, |
18 | private restService: RestService, | ||
15 | private restExtractor: RestExtractor | 19 | private restExtractor: RestExtractor |
16 | ) {} | 20 | ) {} |
17 | 21 | ||
18 | getFriends () { | 22 | getFriends (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> { |
19 | return this.authHttp.get<ResultList<Pod>>(FriendService.BASE_FRIEND_URL) | 23 | let params = new HttpParams() |
24 | params = this.restService.addRestGetParams(params, pagination, sort) | ||
25 | |||
26 | return this.authHttp.get<ResultList<Pod>>(FriendService.BASE_FRIEND_URL, { params }) | ||
20 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | 27 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) |
21 | .catch(res => this.restExtractor.handleError(res)) | 28 | .catch(res => this.restExtractor.handleError(res)) |
22 | } | 29 | } |