import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { api } from '../../../config'; const backuri = api.ADMIN_URL_BACK; @Injectable({ providedIn: 'root' }) export class LocationService { constructor( private http: HttpClient ) { } getLocations() { return this.http.get(`${backuri}/locations`); } checkLocation(name: string) { return this.http.get(`${backuri}/locationbyname/${name}`); } addLocation(name: string) { return this.http.get(`${backuri}/insertlocation/${name}`); } editLocation(locid: string, name: string) { return this.http.post(`${backuri}/editlocation`, {locid, name}); } delLocation(locid: string) { return this.http.post(`${backuri}/dellocation`, {locid}); } }