import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { IRslt, Like } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class LikeService { get route() { return this.api.base + 'like' } constructor(private api: Api) { } setToken(token:string){ this.api.token = token; } getByProduct(id:string): Observable> { return this.api.get(this.route + '/product/' + id) } getByID(): Observable> { return this.api.get(this.route) } post(like: Like): Observable> { return this.api.post(this.route, like) } delete(like: Like): Observable> { return this.api.delete(this.route + '/' + like._id); } }