diff options
Diffstat (limited to 'client/angular/videos/services/videos.service.ts')
-rw-r--r-- | client/angular/videos/services/videos.service.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/client/angular/videos/services/videos.service.ts b/client/angular/videos/services/videos.service.ts index 17ae89c8b..74b6a1ddc 100644 --- a/client/angular/videos/services/videos.service.ts +++ b/client/angular/videos/services/videos.service.ts | |||
@@ -1,14 +1,15 @@ | |||
1 | import {Injectable} from 'angular2/core'; | 1 | import { Injectable } from 'angular2/core'; |
2 | import {Http, Response} from 'angular2/http'; | 2 | import { Http, Response } from 'angular2/http'; |
3 | import {Observable} from 'rxjs/Rx'; | 3 | import { Observable } from 'rxjs/Rx'; |
4 | 4 | ||
5 | import {Video} from '../models/video'; | 5 | import { Video } from '../models/video'; |
6 | import { AuthService } from '../../users/services/auth.service'; | ||
6 | 7 | ||
7 | @Injectable() | 8 | @Injectable() |
8 | export class VideosService { | 9 | export class VideosService { |
9 | private _baseVideoUrl = '/api/v1/videos/'; | 10 | private _baseVideoUrl = '/api/v1/videos/'; |
10 | 11 | ||
11 | constructor (private http: Http) {} | 12 | constructor (private http: Http, private _authService: AuthService) {} |
12 | 13 | ||
13 | getVideos() { | 14 | getVideos() { |
14 | return this.http.get(this._baseVideoUrl) | 15 | return this.http.get(this._baseVideoUrl) |
@@ -24,7 +25,8 @@ export class VideosService { | |||
24 | 25 | ||
25 | removeVideo(id: string) { | 26 | removeVideo(id: string) { |
26 | if (confirm('Are you sure?')) { | 27 | if (confirm('Are you sure?')) { |
27 | return this.http.delete(this._baseVideoUrl + id) | 28 | const options = this._authService.getAuthRequestOptions(); |
29 | return this.http.delete(this._baseVideoUrl + id, options) | ||
28 | .map(res => <number> res.status) | 30 | .map(res => <number> res.status) |
29 | .catch(this.handleError); | 31 | .catch(this.handleError); |
30 | } | 32 | } |