import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { Post } from '../core/entities';

import { environment } from '../../environments/environment';

const POSTS_URL = environment.apiUrl + '/api/posts';

@Injectable()
export class HomeService {

	constructor(private http: HttpClient) {}

	getLastPosts(): Observable<Array<Post>> {
		return this.http.get<Array<Post>>(POSTS_URL + '/last');
	}
}
