summaryrefslogtreecommitdiffstats
path: root/src/app/MainScreenWrapperActionHelper.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/MainScreenWrapperActionHelper.js')
-rw-r--r--src/app/MainScreenWrapperActionHelper.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/app/MainScreenWrapperActionHelper.js b/src/app/MainScreenWrapperActionHelper.js
index 6278f29..3e22206 100644
--- a/src/app/MainScreenWrapperActionHelper.js
+++ b/src/app/MainScreenWrapperActionHelper.js
@@ -20,7 +20,6 @@
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-import {aaiActionTypes} from './MainScreenWrapperConstants.js';
import {
POST,
POST_HEADER,
@@ -36,6 +35,7 @@ import {
getSetGlobalMessageEvent,
getClearGlobalMessageEvent
} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
+import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js';
function createWindowSizeChangeEvent() {
return {
@@ -64,6 +64,45 @@ export function showMainMenu(show) {
};
}
+function createOverlayDataFoundEvent(overlayData, paramName, curData, responseEventKey) {
+ return {
+ type: responseEventKey,
+ data: {
+ paramName: paramName,
+ overlayData: overlayData,
+ curData: curData
+ }
+ };
+}
+
+function overlayViewData(dataFetchRequest, paramName, curData, responseEventKey) {
+ return dispatch => {
+ dataFetchRequest().then(
+ (response) => {
+ return response.json();
+ }
+ ).then(
+ (responseJson) => {
+ dispatch(createOverlayDataFoundEvent(responseJson, paramName, curData, responseEventKey));
+ }).catch(
+ () => {
+ dispatch(getSetGlobalMessageEvent(ERROR_RETRIEVING_DATA, MESSAGE_LEVEL_DANGER));
+ dispatch(createOverlayDataFoundEvent({}, paramName, curData, responseEventKey));
+ });
+ };
+}
+
+export function overlayNetworkCallback(urlApi, postBody, paramName, curData, responseEventKey) {
+ let dataFetchRequest =
+ () => fetchRequestObj(BASE_URL + urlApi, POST,
+ POST_HEADER, JSON.stringify(postBody));
+
+
+ return dispatch => {
+ dispatch(overlayViewData(dataFetchRequest, paramName, curData, responseEventKey));
+ };
+}
+
function createViewDataFoundEvent(viewData, paramName, curViewData) {
var obj = {};
obj['data'] = {};