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

28 lines
968 B
TypeScript

import { DataRepositoryModel } from '../../models/dataRepositories/DataRepositoryModel';
import { Observable } from 'rxjs';
import { HttpHeaders } from '@angular/common/http';
import { HostConfiguration } from '../../app.constants';
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
import { Injectable } from '@angular/core';
@Injectable()
export class DataRepositoryService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: BaseHttpService) {
this.actionUrl = HostConfiguration.Server + 'datarepos/';
this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json');
this.headers = this.headers.set('Accept', 'application/json');
}
create(dataRepoModel: DataRepositoryModel): Observable<DataRepositoryModel> {
return this.http.post<DataRepositoryModel>(this.actionUrl + 'create', dataRepoModel, { headers: this.headers });
}
}