aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/friends/friend.service.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-01 20:36:27 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-01 20:36:27 +0200
commita840d396093ef968f9512862197ac166a1ff9921 (patch)
treef7e4c93ee3ae8a44bd14fd1f7c74234eef7469ef /client/app/friends/friend.service.ts
parent575fdcece562b914149f89f5a5b96ab206648f09 (diff)
downloadPeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.gz
PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.zst
PeerTube-a840d396093ef968f9512862197ac166a1ff9921.zip
Add authentication tokens to make friends/quit friends
Diffstat (limited to 'client/app/friends/friend.service.ts')
-rw-r--r--client/app/friends/friend.service.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/client/app/friends/friend.service.ts b/client/app/friends/friend.service.ts
index bdfa7baec..d3684f08d 100644
--- a/client/app/friends/friend.service.ts
+++ b/client/app/friends/friend.service.ts
@@ -2,20 +2,24 @@ import { Injectable } from '@angular/core';
2import { Http, Response } from '@angular/http'; 2import { Http, Response } from '@angular/http';
3import { Observable } from 'rxjs/Rx'; 3import { Observable } from 'rxjs/Rx';
4 4
5import { AuthService } from '../shared/index';
6
5@Injectable() 7@Injectable()
6export class FriendService { 8export class FriendService {
7 private static BASE_FRIEND_URL: string = '/api/v1/pods/'; 9 private static BASE_FRIEND_URL: string = '/api/v1/pods/';
8 10
9 constructor (private http: Http) {} 11 constructor (private http: Http, private authService: AuthService) {}
10 12
11 makeFriends() { 13 makeFriends() {
12 return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends') 14 const headers = this.authService.getRequestHeader();
15 return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends', { headers })
13 .map(res => res.status) 16 .map(res => res.status)
14 .catch(this.handleError); 17 .catch(this.handleError);
15 } 18 }
16 19
17 quitFriends() { 20 quitFriends() {
18 return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends') 21 const headers = this.authService.getRequestHeader();
22 return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends', { headers })
19 .map(res => res.status) 23 .map(res => res.status)
20 .catch(this.handleError); 24 .catch(this.handleError);
21 } 25 }