aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/services
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
commit1553e15d82b8a1ec4967a90d43b33274f8215c44 (patch)
treeee53fdbb32895153a1fd2470e1c51cf1d9a38e77 /client/angular/videos/services
parent0c1cbbfe29d91c95f9c574b57adf067654b8b5b4 (diff)
downloadPeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.gz
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.zst
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.zip
Implement user requests autorizations in the client side
Diffstat (limited to 'client/angular/videos/services')
-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 }