argos/dmp-frontend/src/app/services/registries/registry.service.ts

27 lines
927 B
TypeScript
Raw Normal View History

2018-10-05 17:00:54 +02:00
import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
2018-11-27 15:13:56 +01:00
import { Observable } from 'rxjs';
import { environment } from '../../../environments/environment';
import { RegisterModel } from '../../models/registers/RegisterModel';
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
2018-09-04 11:36:18 +02:00
@Injectable()
export class RegistryService {
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 + 'registries/';
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(registerModel: RegisterModel): Observable<RegisterModel> {
return this.http.post<RegisterModel>(this.actionUrl + 'create', registerModel, { headers: this.headers });
}
2018-09-04 11:36:18 +02:00
}