Clamp react ui to use url pathname dynamically instead of hardcoded prefix for calling apis
Issue-ID: CLAMP-914
Signed-off-by: Ashwin Sharma <ashwin.shyam.sharma@att.com>
Change-Id: I266aeafe9a543e95bcb96fcab6437227c148f8c4
diff --git a/ui-react/src/api/PolicyToscaService.js b/ui-react/src/api/PolicyToscaService.js
index 610a114..a7bc140 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 @@
}
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 @@
}
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 @@
}
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 @@
}
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: {