FarmMapsLib/projects/common/src/fm/services/schema.service.ts
Mark van der Wal 4527276254
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
Changed schema service.
2020-06-24 11:52:05 +02:00

23 lines
623 B
TypeScript

import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AppConfig} from '../shared/app.config';
import {Observable} from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class SchemaService {
constructor(private httpClient: HttpClient, private appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig('apiEndPoint');
}
/** Takes decoded schema url id */
public getSchema(id): Observable<string> {
const encodedId = encodeURIComponent(id);
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/schema/${encodedId}`);
}
}