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

28 lines
922 B
TypeScript
Raw Normal View History

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