diff options
author | S�bastien Determe <sebastien.determe@intl.att.com> | 2021-04-23 15:54:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-23 15:54:07 +0000 |
commit | 6128857eaa9c6b54bf95cca5f1d6dd2a7bfa1413 (patch) | |
tree | 2720337bbe05e4a0eef1f3f66f45776912373ba3 /ui-react/src/api | |
parent | 9a9e21d172bfe8342755e713136c805bf6139832 (diff) | |
parent | d1ed0a9ba6ffea4006fadf3847495563d11dc12e (diff) |
Merge "ToscaFileSelector"
Diffstat (limited to 'ui-react/src/api')
-rw-r--r-- | ui-react/src/api/PolicyService.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ui-react/src/api/PolicyService.js b/ui-react/src/api/PolicyService.js index 54110f39c..f2886b30a 100644 --- a/ui-react/src/api/PolicyService.js +++ b/ui-react/src/api/PolicyService.js @@ -119,4 +119,30 @@ export default class PolicyService { return undefined; }); } + static sendNewPolicyModel(newPolicyModel) { + return fetch(window.location.pathname + 'restservices/clds/v2/policies/policytype', { + method: 'POST', + credentials: 'same-origin', + headers: { + "Content-Type": "plain/text" + }, + body: newPolicyModel + }) + .then(function (response) { + console.debug("sendNewPolicyModel response received: ", response.status); + if (response.ok) { + console.info("sendNewPolicyModel query successful"); + return response.text(); + } else { + return response.text().then(responseBody => { + throw new Error("HTTP " + response.status + "," + responseBody); + }) + } + }) + .catch(function (error) { + console.error("sendNewPolicyModel error occurred ", error); + alert ("sendNewPolicyModel error occurred " + error); + return undefined; + }); + } } |