aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/friends
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-20 16:24:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-20 16:25:06 +0200
commitbd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 (patch)
tree66df283a1554f27b92e392fca36b8e272d7535bc /client/src/app/friends
parent2f372a865487427ff97ad17edd0e6adfbb478c80 (diff)
downloadPeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.gz
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.zst
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.zip
Client: Add authHttp service that authentificates the http request and
optionally refresh the access token if needed
Diffstat (limited to 'client/src/app/friends')
-rw-r--r--client/src/app/friends/friend.service.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/client/src/app/friends/friend.service.ts b/client/src/app/friends/friend.service.ts
index f956a5ece..771046484 100644
--- a/client/src/app/friends/friend.service.ts
+++ b/client/src/app/friends/friend.service.ts
@@ -1,25 +1,23 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Http, Response } from '@angular/http'; 2import { Response } from '@angular/http';
3import { Observable } from 'rxjs/Observable'; 3import { Observable } from 'rxjs/Observable';
4 4
5import { AuthService } from '../shared'; 5import { AuthHttp, AuthService } from '../shared';
6 6
7@Injectable() 7@Injectable()
8export class FriendService { 8export class FriendService {
9 private static BASE_FRIEND_URL: string = '/api/v1/pods/'; 9 private static BASE_FRIEND_URL: string = '/api/v1/pods/';
10 10
11 constructor (private http: Http, private authService: AuthService) {} 11 constructor (private authHttp: AuthHttp, private authService: AuthService) {}
12 12
13 makeFriends() { 13 makeFriends() {
14 const headers = this.authService.getRequestHeader(); 14 return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'makefriends')
15 return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends', { headers })
16 .map(res => res.status) 15 .map(res => res.status)
17 .catch(this.handleError); 16 .catch(this.handleError);
18 } 17 }
19 18
20 quitFriends() { 19 quitFriends() {
21 const headers = this.authService.getRequestHeader(); 20 return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quitfriends')
22 return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends', { headers })
23 .map(res => res.status) 21 .map(res => res.status)
24 .catch(this.handleError); 22 .catch(this.handleError);
25 } 23 }