1 import { Injectable } from '@angular/core';
2 import { Http, Response } from '@angular/http';
3 import { Observable } from 'rxjs/Rx';
6 export class FriendService {
7 private _baseFriendsUrl = '/api/v1/pods/';
9 constructor (private http: Http) {}
12 return this.http.get(this._baseFriendsUrl + 'makefriends')
13 .map(res => <number> res.status)
14 .catch(this.handleError);
18 return this.http.get(this._baseFriendsUrl + 'quitfriends')
19 .map(res => <number> res.status)
20 .catch(this.handleError);
23 private handleError (error: Response) {
25 return Observable.throw(error.json().error || 'Server error');