aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/services/videos.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/angular/videos/services/videos.service.ts')
-rw-r--r--client/angular/videos/services/videos.service.ts14
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 @@
1import {Injectable} from 'angular2/core'; 1import { Injectable } from 'angular2/core';
2import {Http, Response} from 'angular2/http'; 2import { Http, Response } from 'angular2/http';
3import {Observable} from 'rxjs/Rx'; 3import { Observable } from 'rxjs/Rx';
4 4
5import {Video} from '../models/video'; 5import { Video } from '../models/video';
6import { AuthService } from '../../users/services/auth.service';
6 7
7@Injectable() 8@Injectable()
8export class VideosService { 9export 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 }