import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { IRslt, ConfigDataDTO } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class ConfigService { get route() { return this.api.base + 'config' } constructor(private api: Api) { } setToken(token:string){ this.api.token = token; } getAll(): Observable> { return this.api.get(this.route) } getByID(id:string): Observable> { return this.api.get(this.route + '/' + id) } put(config: ConfigDataDTO): Observable> { return this.api.put(this.route, config) } postAll(configs: Array): Observable> { return this.api.post(this.route + '/all', configs) } post(config: ConfigDataDTO): Observable> { return this.api.post(this.route, config) } delete(config: ConfigDataDTO): Observable> { return this.api.delete(this.route + '/' + config._id); } }