FarmMapsLib/projects/common/src/fm/services/schema.service.ts

23 lines
620 B
TypeScript
Raw Normal View History

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