diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-20 16:24:18 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-20 16:25:06 +0200 |
commit | bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 (patch) | |
tree | 66df283a1554f27b92e392fca36b8e272d7535bc /client/src/app/videos/shared | |
parent | 2f372a865487427ff97ad17edd0e6adfbb478c80 (diff) | |
download | PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.gz PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.zst PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.zip |
Client: Add authHttp service that authentificates the http request and
optionally refresh the access token if needed
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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'; | |||
5 | import { Pagination } from './pagination.model'; | 5 | import { Pagination } from './pagination.model'; |
6 | import { Search } from '../../shared'; | 6 | import { Search } from '../../shared'; |
7 | import { SortField } from './sort-field.type'; | 7 | import { SortField } from './sort-field.type'; |
8 | import { AuthService } from '../../shared'; | 8 | import { AuthHttp, AuthService } from '../../shared'; |
9 | import { Video } from './video.model'; | 9 | import { Video } from './video.model'; |
10 | 10 | ||
11 | @Injectable() | 11 | @Injectable() |
@@ -14,6 +14,7 @@ export class VideoService { | |||
14 | 14 | ||
15 | constructor( | 15 | constructor( |
16 | private authService: AuthService, | 16 | private authService: AuthService, |
17 | private authHttp: AuthHttp, | ||
17 | private http: Http | 18 | private http: Http |
18 | ) {} | 19 | ) {} |
19 | 20 | ||
@@ -35,10 +36,9 @@ export class VideoService { | |||
35 | } | 36 | } |
36 | 37 | ||
37 | removeVideo(id: string) { | 38 | removeVideo(id: string) { |
38 | const options = this.authService.getAuthRequestOptions(); | 39 | return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id) |
39 | return this.http.delete(VideoService.BASE_VIDEO_URL + id, options) | 40 | .map(res => <number> res.status) |
40 | .map(res => <number> res.status) | 41 | .catch(this.handleError); |
41 | .catch(this.handleError); | ||
42 | } | 42 | } |
43 | 43 | ||
44 | searchVideos(search: Search, pagination: Pagination, sort: SortField) { | 44 | searchVideos(search: Search, pagination: Pagination, sort: SortField) { |