28 lines
935 B
TypeScript
28 lines
935 B
TypeScript
|
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 })
|
||
|
}
|
||
|
|
||
|
}
|