Add missed service file
This commit is contained in:
parent
5c019bcaf1
commit
363d1110b4
32
src/app/board/board.service.ts
Normal file
32
src/app/board/board.service.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Http } from '@angular/http';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import 'rxjs/add/observable/of';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
import 'rxjs/add/operator/catch';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ApiResponse,
|
||||||
|
User,
|
||||||
|
Board
|
||||||
|
} from '../shared/index';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class BoardService {
|
||||||
|
constructor(private http: Http) {
|
||||||
|
}
|
||||||
|
|
||||||
|
getBoards(): Observable<ApiResponse> {
|
||||||
|
return this.http.get('api/boards')
|
||||||
|
.map(res => {
|
||||||
|
let response: ApiResponse = res.json();
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch((res, caught) => {
|
||||||
|
let response: ApiResponse = res.json();
|
||||||
|
return Observable.of(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user