import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http'
-import { Injectable, NgZone } from '@angular/core'
+import { Injectable } from '@angular/core'
import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core'
import { buildBulkObservable, objectToFormData } from '@app/helpers'
import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
private authHttp: HttpClient,
private serverService: ServerService,
private restExtractor: RestExtractor,
- private restService: RestService,
- private ngZone: NgZone
+ private restService: RestService
) {
this.videoExistsInPlaylistObservable = merge(
buildBulkObservable({
time: 500,
- ngZone: this.ngZone,
bulkGet: this.doVideosExistInPlaylist.bind(this),
notifierObservable: this.videoExistsInPlaylistNotifier
- }),
+ }).pipe(map(({ response }) => response)),
this.videoExistsInPlaylistCacheSubject
)
)
}
- getPlaylistVideos (
- videoPlaylistId: number | string,
+ getPlaylistVideos (options: {
+ videoPlaylistId: number | string
componentPagination: ComponentPaginationLight
- ): Observable<ResultList<VideoPlaylistElement>> {
- const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos'
- const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
+ }): Observable<ResultList<VideoPlaylistElement>> {
+ const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + options.videoPlaylistId + '/videos'
+ const pagination = this.restService.componentPaginationToRestPagination(options.componentPagination)
let params = new HttpParams()
params = this.restService.addRestGetParams(params, pagination)