aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-29 11:46:26 +0100
committerChocobozzz <me@florianbigard.com>2021-12-29 11:46:26 +0100
commit9744bb2ae8284c4589b66055c1d99997abf18748 (patch)
treead0a5d3d3c44ac34cab4b96ca21d9365b2034d85 /client/src
parent29aedac8dcfc98ff67680d91d6f0f848e86fa4db (diff)
downloadPeerTube-9744bb2ae8284c4589b66055c1d99997abf18748.tar.gz
PeerTube-9744bb2ae8284c4589b66055c1d99997abf18748.tar.zst
PeerTube-9744bb2ae8284c4589b66055c1d99997abf18748.zip
Fix ngx loading bar deprecation
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.service.ts17
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist.service.ts5
2 files changed, 13 insertions, 9 deletions
diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts
index e27dab21a..e90bb0f1f 100644
--- a/client/src/app/shared/shared-main/users/user-notification.service.ts
+++ b/client/src/app/shared/shared-main/users/user-notification.service.ts
@@ -1,8 +1,9 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { catchError, map, tap } from 'rxjs/operators' 2import { catchError, map, tap } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core' 5import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core'
6import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'
6import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' 7import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models'
7import { environment } from '../../../../environments/environment' 8import { environment } from '../../../../environments/environment'
8import { UserNotification } from './user-notification.model' 9import { UserNotification } from './user-notification.model'
@@ -33,9 +34,11 @@ export class UserNotificationService {
33 34
34 if (unread) params = params.append('unread', `${unread}`) 35 if (unread) params = params.append('unread', `${unread}`)
35 36
36 const headers = ignoreLoadingBar ? { ignoreLoadingBar: '' } : undefined 37 const context = ignoreLoadingBar
38 ? new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)
39 : undefined
37 40
38 return this.authHttp.get<ResultList<UserNotification>>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, headers }) 41 return this.authHttp.get<ResultList<UserNotification>>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, context })
39 .pipe( 42 .pipe(
40 map(res => this.restExtractor.convertResultListDateToHuman(res)), 43 map(res => this.restExtractor.convertResultListDateToHuman(res)),
41 map(res => this.restExtractor.applyToResultListData(res, this.formatNotification.bind(this))), 44 map(res => this.restExtractor.applyToResultListData(res, this.formatNotification.bind(this))),
@@ -52,9 +55,9 @@ export class UserNotificationService {
52 const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read' 55 const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read'
53 56
54 const body = { ids: [ notification.id ] } 57 const body = { ids: [ notification.id ] }
55 const headers = { ignoreLoadingBar: '' } 58 const context = new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)
56 59
57 return this.authHttp.post(url, body, { headers }) 60 return this.authHttp.post(url, body, { context })
58 .pipe( 61 .pipe(
59 map(this.restExtractor.extractDataBool), 62 map(this.restExtractor.extractDataBool),
60 tap(() => this.peertubeSocket.dispatchNotificationEvent('read')), 63 tap(() => this.peertubeSocket.dispatchNotificationEvent('read')),
@@ -64,9 +67,9 @@ export class UserNotificationService {
64 67
65 markAllAsRead () { 68 markAllAsRead () {
66 const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read-all' 69 const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read-all'
67 const headers = { ignoreLoadingBar: '' } 70 const context = new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)
68 71
69 return this.authHttp.post(url, {}, { headers }) 72 return this.authHttp.post(url, {}, { context })
70 .pipe( 73 .pipe(
71 map(this.restExtractor.extractDataBool), 74 map(this.restExtractor.extractDataBool),
72 tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')), 75 tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')),
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
index 3faf81d11..44d930b07 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts
@@ -1,11 +1,12 @@
1import * as debug from 'debug' 1import * as debug from 'debug'
2import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs' 2import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
3import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' 3import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
4import { HttpClient, HttpParams } from '@angular/common/http' 4import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' 6import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core'
7import { buildBulkObservable, objectToFormData } from '@app/helpers' 7import { buildBulkObservable, objectToFormData } from '@app/helpers'
8import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' 8import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
9import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'
9import { 10import {
10 ResultList, 11 ResultList,
11 VideoExistInPlaylist, 12 VideoExistInPlaylist,
@@ -350,7 +351,7 @@ export class VideoPlaylistService {
350 let params = new HttpParams() 351 let params = new HttpParams()
351 params = this.restService.addObjectParams(params, { videoIds }) 352 params = this.restService.addObjectParams(params, { videoIds })
352 353
353 return this.authHttp.get<VideoExistInPlaylist>(url, { params, headers: { ignoreLoadingBar: '' } }) 354 return this.authHttp.get<VideoExistInPlaylist>(url, { params, context: new HttpContext().set(NGX_LOADING_BAR_IGNORED, true) })
354 .pipe(catchError(err => this.restExtractor.handleError(err))) 355 .pipe(catchError(err => this.restExtractor.handleError(err)))
355 } 356 }
356} 357}