diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-27 16:23:10 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-27 16:23:10 +0200 |
commit | 41a2aee38cf812510010da09de9bae53590ec119 (patch) | |
tree | 79d55d6ae0ef6f66ccb88890cf1ef1946dc65fb4 /client/app/friends/friend.service.ts | |
parent | 157cb9c9713e08ff70078660a32dd77ecb87eabc (diff) | |
download | PeerTube-41a2aee38cf812510010da09de9bae53590ec119.tar.gz PeerTube-41a2aee38cf812510010da09de9bae53590ec119.tar.zst PeerTube-41a2aee38cf812510010da09de9bae53590ec119.zip |
Follow the angular styleguide for the directories structure
Diffstat (limited to 'client/app/friends/friend.service.ts')
-rw-r--r-- | client/app/friends/friend.service.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/client/app/friends/friend.service.ts b/client/app/friends/friend.service.ts new file mode 100644 index 000000000..d143ec40d --- /dev/null +++ b/client/app/friends/friend.service.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import { Injectable } from '@angular/core'; | ||
2 | import { Http, Response } from '@angular/http'; | ||
3 | import { Observable } from 'rxjs/Rx'; | ||
4 | |||
5 | @Injectable() | ||
6 | export class FriendService { | ||
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 | } | ||