import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { IRslt, Unit } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class UnitService { get route() { return this.api.base + 'unit' } constructor(private api: Api) { } setToken(token:string){ this.api.token = token; } // get(id:string): Observable> { // return this.api.get(this.route + '/product/' + id) // } getByProduct(id:string): Observable> { return this.api.get(this.route + '/product/' + id) } getByProducts(ids:string[]): Observable> { return this.api.post(this.route + '/product',ids) } post(sell: Unit): Observable> { return this.api.post(this.route, sell) } put(sell: Unit): Observable> { return this.api.put(this.route, sell) } delete(sell: Unit): Observable> { return this.api.delete(this.route + '/' + sell._id); } }