diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-15 11:55:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-16 09:42:54 +0200 |
commit | db400f447a9f7aae1c56fa25396e93069744483f (patch) | |
tree | f45af832a5d3f4eebafd2f885b7413d9f84fa374 /client/src/app/shared/video-blacklist | |
parent | 54c3a22faa04bf13eea37f39be9149fc5eb95737 (diff) | |
download | PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.gz PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.zst PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.zip |
Upgrade to rxjs 6
Diffstat (limited to 'client/src/app/shared/video-blacklist')
-rw-r--r-- | client/src/app/shared/video-blacklist/video-blacklist.service.ts | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index 14c8b5dc0..040d82c9a 100644 --- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { catchError, map } from 'rxjs/operators' | ||
1 | import { HttpClient, HttpParams } from '@angular/common/http' | 2 | import { HttpClient, HttpParams } from '@angular/common/http' |
2 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 4 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import 'rxjs/add/operator/catch' | 5 | import { Observable } from 'rxjs' |
5 | import 'rxjs/add/operator/map' | ||
6 | import { Observable } from 'rxjs/Observable' | ||
7 | import { BlacklistedVideo, ResultList } from '../../../../../shared' | 6 | import { BlacklistedVideo, ResultList } from '../../../../../shared' |
8 | import { environment } from '../../../environments/environment' | 7 | import { environment } from '../../../environments/environment' |
9 | import { RestExtractor, RestPagination, RestService } from '../rest' | 8 | import { RestExtractor, RestPagination, RestService } from '../rest' |
@@ -23,19 +22,25 @@ export class VideoBlacklistService { | |||
23 | params = this.restService.addRestGetParams(params, pagination, sort) | 22 | params = this.restService.addRestGetParams(params, pagination, sort) |
24 | 23 | ||
25 | return this.authHttp.get<ResultList<BlacklistedVideo>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) | 24 | return this.authHttp.get<ResultList<BlacklistedVideo>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) |
26 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | 25 | .pipe( |
27 | .catch(res => this.restExtractor.handleError(res)) | 26 | map(res => this.restExtractor.convertResultListDateToHuman(res)), |
27 | catchError(res => this.restExtractor.handleError(res)) | ||
28 | ) | ||
28 | } | 29 | } |
29 | 30 | ||
30 | removeVideoFromBlacklist (videoId: number) { | 31 | removeVideoFromBlacklist (videoId: number) { |
31 | return this.authHttp.delete(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist') | 32 | return this.authHttp.delete(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist') |
32 | .map(this.restExtractor.extractDataBool) | 33 | .pipe( |
33 | .catch(res => this.restExtractor.handleError(res)) | 34 | map(this.restExtractor.extractDataBool), |
35 | catchError(res => this.restExtractor.handleError(res)) | ||
36 | ) | ||
34 | } | 37 | } |
35 | 38 | ||
36 | blacklistVideo (videoId: number) { | 39 | blacklistVideo (videoId: number) { |
37 | return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', {}) | 40 | return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', {}) |
38 | .map(this.restExtractor.extractDataBool) | 41 | .pipe( |
39 | .catch(res => this.restExtractor.handleError(res)) | 42 | map(this.restExtractor.extractDataBool), |
43 | catchError(res => this.restExtractor.handleError(res)) | ||
44 | ) | ||
40 | } | 45 | } |
41 | } | 46 | } |