diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-04-14 22:07:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-04-14 22:07:46 +0200 |
commit | 1553e15d82b8a1ec4967a90d43b33274f8215c44 (patch) | |
tree | ee53fdbb32895153a1fd2470e1c51cf1d9a38e77 /client/angular/videos/services/videos.service.ts | |
parent | 0c1cbbfe29d91c95f9c574b57adf067654b8b5b4 (diff) | |
download | PeerTube-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/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 | } |