import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { IRslt, Product } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class ProductService{ get route(){ return this.api.base + 'product' } constructor(private api:Api){} setToken(token:string){ this.api.token = token; } //return subscriber for all.... get(): Observable> { return this.api.get>(this.route + '/token') } getAll():Observable>{ return this.api.get(this.route + '/all') } getByID(id: string): Observable> { return this.api.get>(this.route + '/' + id) } affiliateFeature():Observable>{ return this.api.get>(this.route + '/featured/affiliate/') } post(product: Product): Observable> { return this.api.post(this.route, product) } put(product: Product): Observable> { return this.api.put(this.route, product) } delete(product: Product): Observable> { return this.api.delete(this.route + '/' + product._id) } }