aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-15 11:55:51 +0200
committerChocobozzz <me@florianbigard.com>2018-05-16 09:42:54 +0200
commitdb400f447a9f7aae1c56fa25396e93069744483f (patch)
treef45af832a5d3f4eebafd2f885b7413d9f84fa374 /client/src/app/+admin/follows/shared
parent54c3a22faa04bf13eea37f39be9149fc5eb95737 (diff)
downloadPeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.gz
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.zst
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.zip
Upgrade to rxjs 6
Diffstat (limited to 'client/src/app/+admin/follows/shared')
-rw-r--r--client/src/app/+admin/follows/shared/follow.service.ts34
1 files changed, 21 insertions, 13 deletions
diff --git a/client/src/app/+admin/follows/shared/follow.service.ts b/client/src/app/+admin/follows/shared/follow.service.ts
index 089be9d64..5897e64ca 100644
--- a/client/src/app/+admin/follows/shared/follow.service.ts
+++ b/client/src/app/+admin/follows/shared/follow.service.ts
@@ -1,9 +1,8 @@
1import { catchError, map } from 'rxjs/operators'
1import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { SortMeta } from 'primeng/primeng' 4import { SortMeta } from 'primeng/primeng'
4import 'rxjs/add/operator/catch' 5import { Observable } from 'rxjs'
5import 'rxjs/add/operator/map'
6import { Observable } from 'rxjs/Observable'
7import { AccountFollow, ResultList } from '../../../../../../shared' 6import { AccountFollow, ResultList } from '../../../../../../shared'
8import { environment } from '../../../../environments/environment' 7import { environment } from '../../../../environments/environment'
9import { RestExtractor, RestPagination, RestService } from '../../../shared' 8import { RestExtractor, RestPagination, RestService } from '../../../shared'
@@ -16,24 +15,29 @@ export class FollowService {
16 private authHttp: HttpClient, 15 private authHttp: HttpClient,
17 private restService: RestService, 16 private restService: RestService,
18 private restExtractor: RestExtractor 17 private restExtractor: RestExtractor
19 ) {} 18 ) {
19 }
20 20
21 getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> { 21 getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> {
22 let params = new HttpParams() 22 let params = new HttpParams()
23 params = this.restService.addRestGetParams(params, pagination, sort) 23 params = this.restService.addRestGetParams(params, pagination, sort)
24 24
25 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/following', { params }) 25 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
26 .map(res => this.restExtractor.convertResultListDateToHuman(res)) 26 .pipe(
27 .catch(res => this.restExtractor.handleError(res)) 27 map(res => this.restExtractor.convertResultListDateToHuman(res)),
28 catchError(res => this.restExtractor.handleError(res))
29 )
28 } 30 }
29 31
30 getFollowers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> { 32 getFollowers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> {
31 let params = new HttpParams() 33 let params = new HttpParams()
32 params = this.restService.addRestGetParams(params, pagination, sort) 34 params = this.restService.addRestGetParams(params, pagination, sort)
33 35
34 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) 36 return this.authHttp.get<ResultList<AccountFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params })
35 .map(res => this.restExtractor.convertResultListDateToHuman(res)) 37 .pipe(
36 .catch(res => this.restExtractor.handleError(res)) 38 map(res => this.restExtractor.convertResultListDateToHuman(res)),
39 catchError(res => this.restExtractor.handleError(res))
40 )
37 } 41 }
38 42
39 follow (notEmptyHosts: string[]) { 43 follow (notEmptyHosts: string[]) {
@@ -42,13 +46,17 @@ export class FollowService {
42 } 46 }
43 47
44 return this.authHttp.post(FollowService.BASE_APPLICATION_URL + '/following', body) 48 return this.authHttp.post(FollowService.BASE_APPLICATION_URL + '/following', body)
45 .map(this.restExtractor.extractDataBool) 49 .pipe(
46 .catch(res => this.restExtractor.handleError(res)) 50 map(this.restExtractor.extractDataBool),
51 catchError(res => this.restExtractor.handleError(res))
52 )
47 } 53 }
48 54
49 unfollow (follow: AccountFollow) { 55 unfollow (follow: AccountFollow) {
50 return this.authHttp.delete(FollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host) 56 return this.authHttp.delete(FollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host)
51 .map(this.restExtractor.extractDataBool) 57 .pipe(
52 .catch(res => this.restExtractor.handleError(res)) 58 map(this.restExtractor.extractDataBool),
59 catchError(res => this.restExtractor.handleError(res))
60 )
53 } 61 }
54} 62}