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