aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/friends
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-14 13:50:19 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-14 13:50:19 +0100
commitdc8bc31be517a53e8fbe7100cfe45cd73f596de0 (patch)
treec0b0d6641dd352dafff93b8fd33ddb262b59aa47 /client/angular/friends
parentbd324a669218f9ed302f7f54b36ee535d25c9733 (diff)
downloadPeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.gz
PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.zst
PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.zip
Angular application :first draft
Diffstat (limited to 'client/angular/friends')
-rw-r--r--client/angular/friends/services/friends.service.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/angular/friends/services/friends.service.ts b/client/angular/friends/services/friends.service.ts
new file mode 100644
index 000000000..a34ef0d6f
--- /dev/null
+++ b/client/angular/friends/services/friends.service.ts
@@ -0,0 +1,27 @@
1import {Injectable} from 'angular2/core';
2import {Http, Response, Headers, RequestOptions} from 'angular2/http';
3import {Observable} from 'rxjs/Rx';
4
5@Injectable()
6export class FriendsService {
7 private _baseFriendsUrl = '/api/v1/pods/';
8
9 constructor (private http: Http) {}
10
11 makeFriends() {
12 return this.http.get(this._baseFriendsUrl + 'makefriends')
13 .map(res => <number> res.status)
14 .catch(this.handleError);
15 }
16
17 quitFriends() {
18 return this.http.get(this._baseFriendsUrl + 'quitfriends')
19 .map(res => <number> res.status)
20 .catch(this.handleError);
21 }
22
23 private handleError (error: Response) {
24 console.error(error);
25 return Observable.throw(error.json().error || 'Server error');
26 }
27}