diff options
Diffstat (limited to 'client/src/app/admin/friends')
-rw-r--r-- | client/src/app/admin/friends/friend.service.ts | 29 | ||||
-rw-r--r-- | client/src/app/admin/friends/index.ts | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/client/src/app/admin/friends/friend.service.ts b/client/src/app/admin/friends/friend.service.ts new file mode 100644 index 000000000..d4ab5e60f --- /dev/null +++ b/client/src/app/admin/friends/friend.service.ts | |||
@@ -0,0 +1,29 @@ | |||
1 | import { Injectable } from '@angular/core'; | ||
2 | import { Response } from '@angular/http'; | ||
3 | import { Observable } from 'rxjs/Observable'; | ||
4 | |||
5 | import { AuthHttp, AuthService } from '../../shared'; | ||
6 | |||
7 | @Injectable() | ||
8 | export class FriendService { | ||
9 | private static BASE_FRIEND_URL: string = '/api/v1/pods/'; | ||
10 | |||
11 | constructor (private authHttp: AuthHttp, private authService: AuthService) {} | ||
12 | |||
13 | makeFriends() { | ||
14 | return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'makefriends') | ||
15 | .map(res => res.status) | ||
16 | .catch(this.handleError); | ||
17 | } | ||
18 | |||
19 | quitFriends() { | ||
20 | return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quitfriends') | ||
21 | .map(res => res.status) | ||
22 | .catch(this.handleError); | ||
23 | } | ||
24 | |||
25 | private handleError (error: Response): Observable<number> { | ||
26 | console.error(error); | ||
27 | return Observable.throw(error.json().error || 'Server error'); | ||
28 | } | ||
29 | } | ||
diff --git a/client/src/app/admin/friends/index.ts b/client/src/app/admin/friends/index.ts new file mode 100644 index 000000000..0adc256c4 --- /dev/null +++ b/client/src/app/admin/friends/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './friend.service'; | |||