From bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Jul 2016 16:24:18 +0200 Subject: Client: Add authHttp service that authentificates the http request and optionally refresh the access token if needed --- client/src/app/videos/shared/video.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client/src/app/videos/shared/video.service.ts') diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index dcbef7717..b4396f767 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs/Observable'; import { Pagination } from './pagination.model'; import { Search } from '../../shared'; import { SortField } from './sort-field.type'; -import { AuthService } from '../../shared'; +import { AuthHttp, AuthService } from '../../shared'; import { Video } from './video.model'; @Injectable() @@ -14,6 +14,7 @@ export class VideoService { constructor( private authService: AuthService, + private authHttp: AuthHttp, private http: Http ) {} @@ -35,10 +36,9 @@ export class VideoService { } removeVideo(id: string) { - const options = this.authService.getAuthRequestOptions(); - return this.http.delete(VideoService.BASE_VIDEO_URL + id, options) - .map(res => res.status) - .catch(this.handleError); + return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id) + .map(res => res.status) + .catch(this.handleError); } searchVideos(search: Search, pagination: Pagination, sort: SortField) { -- cgit v1.2.3