From 1553e15d82b8a1ec4967a90d43b33274f8215c44 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Apr 2016 22:07:46 +0200 Subject: Implement user requests autorizations in the client side --- client/angular/videos/services/videos.service.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'client/angular/videos/services') 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 @@ -import {Injectable} from 'angular2/core'; -import {Http, Response} from 'angular2/http'; -import {Observable} from 'rxjs/Rx'; +import { Injectable } from 'angular2/core'; +import { Http, Response } from 'angular2/http'; +import { Observable } from 'rxjs/Rx'; -import {Video} from '../models/video'; +import { Video } from '../models/video'; +import { AuthService } from '../../users/services/auth.service'; @Injectable() export class VideosService { private _baseVideoUrl = '/api/v1/videos/'; - constructor (private http: Http) {} + constructor (private http: Http, private _authService: AuthService) {} getVideos() { return this.http.get(this._baseVideoUrl) @@ -24,7 +25,8 @@ export class VideosService { removeVideo(id: string) { if (confirm('Are you sure?')) { - return this.http.delete(this._baseVideoUrl + id) + const options = this._authService.getAuthRequestOptions(); + return this.http.delete(this._baseVideoUrl + id, options) .map(res => res.status) .catch(this.handleError); } -- cgit v1.2.3