diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
commit | a840d396093ef968f9512862197ac166a1ff9921 (patch) | |
tree | f7e4c93ee3ae8a44bd14fd1f7c74234eef7469ef /client/app/friends | |
parent | 575fdcece562b914149f89f5a5b96ab206648f09 (diff) | |
download | PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.gz PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.zst PeerTube-a840d396093ef968f9512862197ac166a1ff9921.zip |
Add authentication tokens to make friends/quit friends
Diffstat (limited to 'client/app/friends')
-rw-r--r-- | client/app/friends/friend.service.ts | 10 |
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'; | |||
2 | import { Http, Response } from '@angular/http'; | 2 | import { Http, Response } from '@angular/http'; |
3 | import { Observable } from 'rxjs/Rx'; | 3 | import { Observable } from 'rxjs/Rx'; |
4 | 4 | ||
5 | import { AuthService } from '../shared/index'; | ||
6 | |||
5 | @Injectable() | 7 | @Injectable() |
6 | export class FriendService { | 8 | export 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 | } |