diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-30 22:41:14 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-30 22:41:14 +0100 |
commit | 28798b5d949826551740fc893d06e6424b77aa6a (patch) | |
tree | e235a7f49164a06c4b76df49ca61b89998d4ed81 /client/src/app/+admin/friends/shared/friend.service.ts | |
parent | 13fc89f4a4b91b3da10493517de556240fb65463 (diff) | |
download | PeerTube-28798b5d949826551740fc893d06e6424b77aa6a.tar.gz PeerTube-28798b5d949826551740fc893d06e6424b77aa6a.tar.zst PeerTube-28798b5d949826551740fc893d06e6424b77aa6a.zip |
Client: replace simple tables by ng2 smart table component
Diffstat (limited to 'client/src/app/+admin/friends/shared/friend.service.ts')
-rw-r--r-- | client/src/app/+admin/friends/shared/friend.service.ts | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts index e97459385..6cb84f5cd 100644 --- a/client/src/app/+admin/friends/shared/friend.service.ts +++ b/client/src/app/+admin/friends/shared/friend.service.ts | |||
@@ -3,8 +3,10 @@ import { Observable } from 'rxjs/Observable'; | |||
3 | import 'rxjs/add/operator/catch'; | 3 | import 'rxjs/add/operator/catch'; |
4 | import 'rxjs/add/operator/map'; | 4 | import 'rxjs/add/operator/map'; |
5 | 5 | ||
6 | import { ServerDataSource } from 'ng2-smart-table'; | ||
7 | |||
6 | import { Friend } from './friend.model'; | 8 | import { Friend } from './friend.model'; |
7 | import { AuthHttp, RestExtractor, ResultList } from '../../../shared'; | 9 | import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared'; |
8 | 10 | ||
9 | @Injectable() | 11 | @Injectable() |
10 | export class FriendService { | 12 | export class FriendService { |
@@ -15,11 +17,8 @@ export class FriendService { | |||
15 | private restExtractor: RestExtractor | 17 | private restExtractor: RestExtractor |
16 | ) {} | 18 | ) {} |
17 | 19 | ||
18 | getFriends() { | 20 | getDataSource() { |
19 | return this.authHttp.get(FriendService.BASE_FRIEND_URL) | 21 | return new RestDataSource(this.authHttp, FriendService.BASE_FRIEND_URL); |
20 | .map(this.restExtractor.extractDataList) | ||
21 | .map(this.extractFriends) | ||
22 | .catch((res) => this.restExtractor.handleError(res)); | ||
23 | } | 22 | } |
24 | 23 | ||
25 | makeFriends(notEmptyHosts) { | 24 | makeFriends(notEmptyHosts) { |
@@ -37,11 +36,4 @@ export class FriendService { | |||
37 | .map(res => res.status) | 36 | .map(res => res.status) |
38 | .catch((res) => this.restExtractor.handleError(res)); | 37 | .catch((res) => this.restExtractor.handleError(res)); |
39 | } | 38 | } |
40 | |||
41 | private extractFriends(result: ResultList) { | ||
42 | const friends: Friend[] = result.data; | ||
43 | const totalFriends = result.total; | ||
44 | |||
45 | return { friends, totalFriends }; | ||
46 | } | ||
47 | } | 39 | } |