diff options
Diffstat (limited to 'ui-react/src/components/backend_communication/LoopActionService.js')
-rw-r--r-- | ui-react/src/components/backend_communication/LoopActionService.js | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/ui-react/src/components/backend_communication/LoopActionService.js b/ui-react/src/components/backend_communication/LoopActionService.js index 027243be..9ce8ff0a 100644 --- a/ui-react/src/components/backend_communication/LoopActionService.js +++ b/ui-react/src/components/backend_communication/LoopActionService.js @@ -20,37 +20,35 @@ * =================================================================== * */ -const clActionService = { - submit +const loopActionService = { + submit }; + function submit(uiAction) { - const cl_name = ""; - console.log("clActionServices perform action: " + uiAction + " closedloopName=" - + cl_name); - const svcAction = uiAction.toLowerCase(); - const svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + cl_name; + const cl_name = ""; + console.log("clActionServices perform action: " + uiAction + " closedloopName=" + + cl_name); + const svcAction = uiAction.toLowerCase(); + const svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + cl_name; - let options = { - method: 'GET' - }; - return sendRequest (svcUrl, svcAction, options); + let options = { + method: 'GET' + }; + return sendRequest(svcUrl, svcAction, options); } +function sendRequest(svcUrl, svcAction) { + fetch(svcUrl, options) + .then( + response => { + alertService.alertMessage("Action Successful: " + svcAction, 1) + }).error(error => { + alertService.alertMessage("Action Failure: " + svcAction, 2); + return Promise.reject(error); + }); + return response.json(); +}; -function sendRequest (svcUrl, svcAction) { - fetch(svcUrl, options) - .then( - response => { - alertService.alertMessage("Action Successful: " + svcAction, 1) - }).error( error => { - alertService.alertMessage("Action Failure: " + svcAction, 2); - return Promise.reject(error); - }); - - return response.json(); - }); -} - -export default clActionService; +export default loopActionService;
\ No newline at end of file |