From 45272762546eb7848108f4cbda7378be24486fc2 Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Wed, 24 Jun 2020 11:52:05 +0200 Subject: [PATCH] Changed schema service. --- .../common/src/fm/services/schema.service.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/projects/common/src/fm/services/schema.service.ts b/projects/common/src/fm/services/schema.service.ts index acdfae6..46ab4c2 100644 --- a/projects/common/src/fm/services/schema.service.ts +++ b/projects/common/src/fm/services/schema.service.ts @@ -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 { - const id = this.getSchemaIdFromSchemaUrl(schemaUrl); - return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/schema/${id}`); - } - - public getSchemaWithId(schemaId): Observable { - return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/schema/${schemaId}`); + /** Takes decoded schema url id */ + public getSchema(id): Observable { + const encodedId = encodeURIComponent(id); + return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/schema/${encodedId}`); } }