import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpClient } from '@angular/common/http';

import { environment } from '../../../environments/environment';
import { Post } from '../../core/entities';

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

@Injectable()
export class MyPostsService {

	constructor(private http: HttpClient) {}

	getMyPosts(): Observable<Array<Post>> {
		return this.http.get<Array<Post>>(`${POSTS_URL}/myPosts`);
	}
}
