From e673a058c995392b3ad6cbab91a9571bed29a57b Mon Sep 17 00:00:00 2001 From: Ashwin Sharma Date: Thu, 30 Jul 2020 16:05:02 +0000 Subject: Clamp react ui to use url pathname dynamically instead of hardcoded prefix for calling apis Issue-ID: CLAMP-914 Signed-off-by: Ashwin Sharma Change-Id: I266aeafe9a543e95bcb96fcab6437227c148f8c4 --- ui-react/src/api/PolicyToscaService.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ui-react/src/api/PolicyToscaService.js') diff --git a/ui-react/src/api/PolicyToscaService.js b/ui-react/src/api/PolicyToscaService.js index 610a11418..a7bc140b6 100644 --- a/ui-react/src/api/PolicyToscaService.js +++ b/ui-react/src/api/PolicyToscaService.js @@ -22,7 +22,7 @@ export default class PolicyToscaService { static getToscaPolicyModels() { - return fetch('restservices/clds/v2/policyToscaModels', { method: 'GET', credentials: 'same-origin' }) + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels', { method: 'GET', credentials: 'same-origin' }) .then(function (response) { console.debug("getToscaPolicyModels response received: ", response.status); if (response.ok) { @@ -39,7 +39,7 @@ export default class PolicyToscaService { } static getToscaPolicyModelYaml(policyModelType, policyModelVersion) { - return fetch('/restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, { + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, { method: 'GET', credentials: 'same-origin' }) @@ -59,7 +59,7 @@ export default class PolicyToscaService { } static getToscaPolicyModel(policyModelType, policyModelVersion) { - return fetch('/restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, { + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, { method: 'GET', credentials: 'same-origin' }) @@ -79,7 +79,7 @@ export default class PolicyToscaService { } static createPolicyModelFromToscaModel(jsonData) { - return fetch('/restservices/clds/v2/policyToscaModels', { + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels', { method: 'POST', credentials: 'same-origin', headers: { @@ -107,7 +107,7 @@ export default class PolicyToscaService { } static updatePolicyModelTosca(policyModelType, policyModelVersion, jsonData) { - return fetch('/restservices/clds/v2/policyToscaModels/' + policyModelType + '/' + policyModelVersion, { + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + '/' + policyModelVersion, { method: 'PUT', credentials: 'same-origin', headers: { -- cgit 1.2.3-korg