diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-04 20:59:23 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-04 21:05:13 +0100 |
commit | 55fa55a9be566cca2ba95322f2ae23b434aed62a (patch) | |
tree | f51ef35c120ce8a928917a659418079538cdb8dc /client/src/app/admin/friends | |
parent | a6fd2b30bf717eec14972a2175354781f5f43e77 (diff) | |
download | PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.gz PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.tar.zst PeerTube-55fa55a9be566cca2ba95322f2ae23b434aed62a.zip |
Server: add video abuse support
Diffstat (limited to 'client/src/app/admin/friends')
-rw-r--r-- | client/src/app/admin/friends/friend-list/friend-list.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/admin/friends/shared/friend.service.ts | 16 |
2 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.ts b/client/src/app/admin/friends/friend-list/friend-list.component.ts index 88c4800ee..bec10162c 100644 --- a/client/src/app/admin/friends/friend-list/friend-list.component.ts +++ b/client/src/app/admin/friends/friend-list/friend-list.component.ts | |||
@@ -30,7 +30,7 @@ export class FriendListComponent implements OnInit { | |||
30 | 30 | ||
31 | private getFriends() { | 31 | private getFriends() { |
32 | this.friendService.getFriends().subscribe( | 32 | this.friendService.getFriends().subscribe( |
33 | friends => this.friends = friends, | 33 | res => this.friends = res.friends, |
34 | 34 | ||
35 | err => alert(err.text) | 35 | err => alert(err.text) |
36 | ); | 36 | ); |
diff --git a/client/src/app/admin/friends/shared/friend.service.ts b/client/src/app/admin/friends/shared/friend.service.ts index 8a1ba6b02..85ac04ba0 100644 --- a/client/src/app/admin/friends/shared/friend.service.ts +++ b/client/src/app/admin/friends/shared/friend.service.ts | |||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; | |||
2 | import { Observable } from 'rxjs/Observable'; | 2 | import { Observable } from 'rxjs/Observable'; |
3 | 3 | ||
4 | import { Friend } from './friend.model'; | 4 | import { Friend } from './friend.model'; |
5 | import { AuthHttp, RestExtractor } from '../../../shared'; | 5 | import { AuthHttp, RestExtractor, ResultList } from '../../../shared'; |
6 | 6 | ||
7 | @Injectable() | 7 | @Injectable() |
8 | export class FriendService { | 8 | export class FriendService { |
@@ -13,11 +13,10 @@ export class FriendService { | |||
13 | private restExtractor: RestExtractor | 13 | private restExtractor: RestExtractor |
14 | ) {} | 14 | ) {} |
15 | 15 | ||
16 | getFriends(): Observable<Friend[]> { | 16 | getFriends() { |
17 | return this.authHttp.get(FriendService.BASE_FRIEND_URL) | 17 | return this.authHttp.get(FriendService.BASE_FRIEND_URL) |
18 | // Not implemented as a data list by the server yet | 18 | .map(this.restExtractor.extractDataList) |
19 | // .map(this.restExtractor.extractDataList) | 19 | .map(this.extractFriends) |
20 | .map((res) => res.json()) | ||
21 | .catch((res) => this.restExtractor.handleError(res)); | 20 | .catch((res) => this.restExtractor.handleError(res)); |
22 | } | 21 | } |
23 | 22 | ||
@@ -36,4 +35,11 @@ export class FriendService { | |||
36 | .map(res => res.status) | 35 | .map(res => res.status) |
37 | .catch((res) => this.restExtractor.handleError(res)); | 36 | .catch((res) => this.restExtractor.handleError(res)); |
38 | } | 37 | } |
38 | |||
39 | private extractFriends(result: ResultList) { | ||
40 | const friends: Friend[] = result.data; | ||
41 | const totalFriends = result.total; | ||
42 | |||
43 | return { friends, totalFriends }; | ||
44 | } | ||
39 | } | 45 | } |