diff options
Diffstat (limited to 'client/src/app/+admin/friends/shared')
-rw-r--r-- | client/src/app/+admin/friends/shared/friend.service.ts | 52 | ||||
-rw-r--r-- | client/src/app/+admin/friends/shared/index.ts | 1 |
2 files changed, 0 insertions, 53 deletions
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts deleted file mode 100644 index 867656a53..000000000 --- a/client/src/app/+admin/friends/shared/friend.service.ts +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { HttpClient, HttpParams } from '@angular/common/http' | ||
3 | import { Observable } from 'rxjs/Observable' | ||
4 | import 'rxjs/add/operator/catch' | ||
5 | import 'rxjs/add/operator/map' | ||
6 | |||
7 | import { SortMeta } from 'primeng/primeng' | ||
8 | |||
9 | import { RestExtractor, RestPagination, RestService } from '../../../shared' | ||
10 | import { Pod, ResultList } from '../../../../../../shared' | ||
11 | |||
12 | @Injectable() | ||
13 | export class FriendService { | ||
14 | private static BASE_FRIEND_URL = API_URL + '/api/v1/pods/' | ||
15 | |||
16 | constructor ( | ||
17 | private authHttp: HttpClient, | ||
18 | private restService: RestService, | ||
19 | private restExtractor: RestExtractor | ||
20 | ) {} | ||
21 | |||
22 | getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> { | ||
23 | let params = new HttpParams() | ||
24 | params = this.restService.addRestGetParams(params, pagination, sort) | ||
25 | |||
26 | return this.authHttp.get<ResultList<Account>>(API_URL + '/api/v1/pods/followers', { params }) | ||
27 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | ||
28 | .catch(res => this.restExtractor.handleError(res)) | ||
29 | } | ||
30 | |||
31 | follow (notEmptyHosts: String[]) { | ||
32 | const body = { | ||
33 | hosts: notEmptyHosts | ||
34 | } | ||
35 | |||
36 | return this.authHttp.post(API_URL + '/api/v1/pods/follow', body) | ||
37 | .map(this.restExtractor.extractDataBool) | ||
38 | .catch(res => this.restExtractor.handleError(res)) | ||
39 | } | ||
40 | |||
41 | quitFriends () { | ||
42 | return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quit-friends') | ||
43 | .map(this.restExtractor.extractDataBool) | ||
44 | .catch(res => this.restExtractor.handleError(res)) | ||
45 | } | ||
46 | |||
47 | removeFriend (friend: Pod) { | ||
48 | return this.authHttp.delete(FriendService.BASE_FRIEND_URL + friend.id) | ||
49 | .map(this.restExtractor.extractDataBool) | ||
50 | .catch(res => this.restExtractor.handleError(res)) | ||
51 | } | ||
52 | } | ||
diff --git a/client/src/app/+admin/friends/shared/index.ts b/client/src/app/+admin/friends/shared/index.ts deleted file mode 100644 index 65ab9fb46..000000000 --- a/client/src/app/+admin/friends/shared/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './friend.service' | ||