import { Injectable } from '@angular/core';
import { environment } from '../../../../environments/environment';
import { HttpClient } from '@angular/common/http';
import { Category } from '../../interfaces/site/category/category';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class CategoryService {

  BASE_URL_API = environment.BASE_URL_API + "/categories"

  constructor(private http: HttpClient) { }

  getCategories(): Observable<Category[]> {
    return this.http.get<Category[]>(this.BASE_URL_API);
  }
  getCategory(id: string): Observable<Category> {
    return this.http.get<Category>(`${this.BASE_URL_API}/${id}`)
  }
}
