Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-06-24 13:08:27 +02:00
commit 146514d386

View File

@ -14,19 +14,9 @@ export class SchemaService {
return this.appConfig.getConfig('apiEndPoint');
}
public getSchemaIdFromSchemaUrl(schemaUrl): string {
const url = new URL(schemaUrl);
const pathSplit = url.pathname.split('/');
return pathSplit[pathSplit.length - 1].replace('.json', '');
}
public getSchemaWithUrl(schemaUrl): Observable<string> {
const id = this.getSchemaIdFromSchemaUrl(schemaUrl);
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/schema/${id}`);
}
public getSchemaWithId(schemaId): Observable<string> {
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/schema/${schemaId}`);
/** 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}`);
}
}