diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-03 15:01:17 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-03 15:01:17 +0100 |
commit | b7819090de8ced71e5f9c5773c575ab627a148e4 (patch) | |
tree | 1da6089c12e5b60ea2d0868dc5ccecc3d2abfe5d /client/src/app/shared/video-playlist | |
parent | ac0868bcc0259d4ff14265d9ae403e10869a13aa (diff) | |
download | PeerTube-b7819090de8ced71e5f9c5773c575ab627a148e4.tar.gz PeerTube-b7819090de8ced71e5f9c5773c575ab627a148e4.tar.zst PeerTube-b7819090de8ced71e5f9c5773c575ab627a148e4.zip |
Move watch later logic in miniature
Diffstat (limited to 'client/src/app/shared/video-playlist')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.service.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index fc3b77b2a..d78fdc09f 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { bufferTime, catchError, filter, first, map, share, switchMap } from 'rxjs/operators' | 1 | import { bufferTime, catchError, distinctUntilChanged, filter, first, map, share, switchMap } from 'rxjs/operators' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
3 | import { Observable, ReplaySubject, Subject } from 'rxjs' | 3 | import { Observable, ReplaySubject, Subject } from 'rxjs' |
4 | import { RestExtractor } from '../rest/rest-extractor.service' | 4 | import { RestExtractor } from '../rest/rest-extractor.service' |
@@ -30,7 +30,6 @@ export class VideoPlaylistService { | |||
30 | // Use a replay subject because we "next" a value before subscribing | 30 | // Use a replay subject because we "next" a value before subscribing |
31 | private videoExistsInPlaylistSubject: Subject<number> = new ReplaySubject(1) | 31 | private videoExistsInPlaylistSubject: Subject<number> = new ReplaySubject(1) |
32 | private readonly videoExistsInPlaylistObservable: Observable<VideoExistInPlaylist> | 32 | private readonly videoExistsInPlaylistObservable: Observable<VideoExistInPlaylist> |
33 | private cachedWatchLaterPlaylists: VideoPlaylist[] | ||
34 | 33 | ||
35 | constructor ( | 34 | constructor ( |
36 | private authHttp: HttpClient, | 35 | private authHttp: HttpClient, |
@@ -39,6 +38,7 @@ export class VideoPlaylistService { | |||
39 | private restService: RestService | 38 | private restService: RestService |
40 | ) { | 39 | ) { |
41 | this.videoExistsInPlaylistObservable = this.videoExistsInPlaylistSubject.pipe( | 40 | this.videoExistsInPlaylistObservable = this.videoExistsInPlaylistSubject.pipe( |
41 | distinctUntilChanged(), | ||
42 | bufferTime(500), | 42 | bufferTime(500), |
43 | filter(videoIds => videoIds.length !== 0), | 43 | filter(videoIds => videoIds.length !== 0), |
44 | switchMap(videoIds => this.doVideosExistInPlaylist(videoIds)), | 44 | switchMap(videoIds => this.doVideosExistInPlaylist(videoIds)), |
@@ -224,7 +224,7 @@ export class VideoPlaylistService { | |||
224 | let params = new HttpParams() | 224 | let params = new HttpParams() |
225 | params = this.restService.addObjectParams(params, { videoIds }) | 225 | params = this.restService.addObjectParams(params, { videoIds }) |
226 | 226 | ||
227 | return this.authHttp.get<VideoExistInPlaylist>(url, { params }) | 227 | return this.authHttp.get<VideoExistInPlaylist>(url, { params, headers: { ignoreLoadingBar: '' } }) |
228 | .pipe(catchError(err => this.restExtractor.handleError(err))) | 228 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
229 | } | 229 | } |
230 | } | 230 | } |