argos/dmp-frontend/src/app/services/services/services-data.service.ts

28 lines
935 B
TypeScript
Raw Normal View History

2018-09-04 11:36:18 +02:00
import { Injectable } from "@angular/core";
import { HttpHeaders } from "@angular/common/http";
import { BaseHttpService } from "../../utilities/cite-http-service-module/base-http.service";
import { HostConfiguration } from "../../app.constants";
import { ServiceModel } from "../../models/services/ServiceModel";
import { Observable } from "rxjs";
@Injectable()
export class ServicesDataService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: BaseHttpService) {
this.actionUrl = HostConfiguration.Server + 'services/';
this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json');
this.headers = this.headers.set('Accept', 'application/json');
}
create(serviceModel: ServiceModel): Observable<ServiceModel> {
return this.http.post<ServiceModel>(this.actionUrl + 'create', serviceModel, { headers: this.headers })
}
}