diff options
-rw-r--r-- | client/src/app/shared/shared-main/users/user-notification.service.ts | 17 | ||||
-rw-r--r-- | client/src/app/shared/shared-video-playlist/video-playlist.service.ts | 5 |
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 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { catchError, map, tap } from 'rxjs/operators' | 2 | import { catchError, map, tap } from 'rxjs/operators' |
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core' | 5 | import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core' |
6 | import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client' | ||
6 | import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' | 7 | import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' |
7 | import { environment } from '../../../../environments/environment' | 8 | import { environment } from '../../../../environments/environment' |
8 | import { UserNotification } from './user-notification.model' | 9 | import { 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 @@ | |||
1 | import * as debug from 'debug' | 1 | import * as debug from 'debug' |
2 | import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs' | 2 | import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs' |
3 | import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' | 3 | import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' |
4 | import { HttpClient, HttpParams } from '@angular/common/http' | 4 | import { HttpClient, HttpContext, HttpParams } from '@angular/common/http' |
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' | 6 | import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' |
7 | import { buildBulkObservable, objectToFormData } from '@app/helpers' | 7 | import { buildBulkObservable, objectToFormData } from '@app/helpers' |
8 | import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 8 | import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
9 | import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client' | ||
9 | import { | 10 | import { |
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 | } |