return this.buildBaseFeedUrls(params)
}
- searchVideos (
- search: string,
- videoPagination: ComponentPagination,
- sort: VideoSortField
- ): Observable<{ videos: Video[], totalVideos: number }> {
- const url = VideoService.BASE_VIDEO_URL + 'search'
-
- const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
-
- let params = new HttpParams()
- params = this.restService.addRestGetParams(params, pagination, sort)
- params = params.append('search', search)
-
- return this.authHttp
- .get<ResultList<VideoServerModel>>(url, { params })
- .pipe(
- switchMap(res => this.extractVideos(res)),
- catchError(err => this.restExtractor.handleError(err))
- )
- }
-
removeVideo (id: number) {
return this.authHttp
.delete(VideoService.BASE_VIDEO_URL + id)
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
- private setVideoRate (id: number, rateType: VideoRateType) {
- const url = VideoService.BASE_VIDEO_URL + id + '/rate'
- const body: UserVideoRateUpdate = {
- rating: rateType
- }
-
- return this.authHttp
- .put(url, body)
- .pipe(
- map(this.restExtractor.extractDataBool),
- catchError(err => this.restExtractor.handleError(err))
- )
- }
-
- private extractVideos (result: ResultList<VideoServerModel>) {
+ extractVideos (result: ResultList<VideoServerModel>) {
return this.serverService.localeObservable
.pipe(
map(translations => {
})
)
}
+
+ private setVideoRate (id: number, rateType: VideoRateType) {
+ const url = VideoService.BASE_VIDEO_URL + id + '/rate'
+ const body: UserVideoRateUpdate = {
+ rating: rateType
+ }
+
+ return this.authHttp
+ .put(url, body)
+ .pipe(
+ map(this.restExtractor.extractDataBool),
+ catchError(err => this.restExtractor.handleError(err))
+ )
+ }
}