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

@Injectable()
export class SearchService {

	constructor(private http: HttpClient) {}

	search(searchCriteria: string): Observable<Array<Post>> {
		return this.http.get<Array<Post>>(`/api/posts/search/${searchCriteria}`);
	}
}
