Newer
Older
CamaraComercioWeb / src / app / core / services / site / site.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http"
import { Observable } from 'rxjs';
import { Site } from '../../interfaces/site/site';
import { environment } from '../../../../environments/environment';
import { SITES } from '../../mocks/data';

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

  BASE_URL_API = environment.BASE_URL_API + "/sites"

  constructor(private http: HttpClient) { }

  getSites(): Observable<Site[]> {
    return this.http.get<Site[]>(this.BASE_URL_API, {
      headers: {
        "Access-Control-Request-Headers": "*",
        "Access-Control-Request-Method": "*"
      }
    });
  }

  getSite(id: string): Observable<Site> {
    return this.http.get<Site>(`${this.BASE_URL_API}/${id}`)
  }

}