import * as debug from 'debug'
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 { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
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'
+import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'
import {
ResultList,
VideoExistInPlaylist,
return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id, data)
.pipe(
- map(this.restExtractor.extractDataBool),
tap(() => {
if (!this.myAccountPlaylistCache) return
removeVideoPlaylist (videoPlaylist: VideoPlaylist) {
return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id)
.pipe(
- map(this.restExtractor.extractDataBool),
tap(() => {
if (!this.myAccountPlaylistCache) return
updateVideoOfPlaylist (playlistId: number, playlistElementId: number, body: VideoPlaylistElementUpdate, videoId: number) {
return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId, body)
.pipe(
- map(this.restExtractor.extractDataBool),
tap(() => {
const existsResult = this.videoExistsCache[videoId]
removeVideoFromPlaylist (playlistId: number, playlistElementId: number, videoId?: number) {
return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId)
.pipe(
- map(this.restExtractor.extractDataBool),
tap(() => {
if (!videoId) return
}
return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body)
- .pipe(
- map(this.restExtractor.extractDataBool),
- catchError(err => this.restExtractor.handleError(err))
- )
+ .pipe(catchError(err => this.restExtractor.handleError(err)))
}
getPlaylistVideos (options: {
let params = new HttpParams()
params = this.restService.addObjectParams(params, { videoIds })
- return this.authHttp.get<VideoExistInPlaylist>(url, { params, headers: { ignoreLoadingBar: '' } })
+ return this.authHttp.get<VideoExistInPlaylist>(url, { params, context: new HttpContext().set(NGX_LOADING_BAR_IGNORED, true) })
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
}