import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {LocationEntity} from "../../interface/LocationEntity"; const BASE_URL = "progetto152"; const LOCATION = BASE_URL + "/location"; @Injectable({ providedIn: 'root', }) export class LocationService { constructor( private http: HttpClient, ) { } getLocations() { return this.http.get(LOCATION); } getLocation(location: string) { return this.http.get(LOCATION + "/" + location); } createLocation(location: LocationEntity) { return this.http.post(LOCATION, location); } updateLocation(location: LocationEntity) { return this.http.put(LOCATION+"/"+location.location, location); } deleteLocation(location: string) { return this.http.delete(LOCATION +"/"+ location); } }