import { Injectable } from '@angular/core'; import { of } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import { AppService } from '../app'; import { Business, BusinessJson } from '../../models'; @Injectable({providedIn:'root'}) export class BusinessesService { ext = "/businesses"; constructor(private app:AppService){} fetch(){return this.app.http.get(this.ext);} fetchOne(businessName:string){return this.app.http.get(this.ext+"/"+businessName);} create(o:{businessName:string}){return this.app.http.post(this.ext,o);} update(id:string,updates:Partial){return this.app.http.put(this.ext+"/"+id,updates);} remove(id:string){return this.app.http.del(this.ext+"/"+id);} }