summaryrefslogtreecommitdiffstats
path: root/src/app/contextHandler/ContextHandlerActions.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/contextHandler/ContextHandlerActions.js')
-rw-r--r--src/app/contextHandler/ContextHandlerActions.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/app/contextHandler/ContextHandlerActions.js b/src/app/contextHandler/ContextHandlerActions.js
index 889020a..0fe43ff 100644
--- a/src/app/contextHandler/ContextHandlerActions.js
+++ b/src/app/contextHandler/ContextHandlerActions.js
@@ -65,17 +65,22 @@ function getExternalParamValues(urlParams) {
}
function createSubscriptionPayloadEvent(payload) {
- return {
- type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_FOUND,
- data: payload
- };
-}
-function createSubscriptionIsEmptyEvent() {
- return {
- type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_EMPTY,
- data: {}
- };
+ let event = undefined;
+
+ if (payload.subscriptionEnabled) {
+ event = {
+ type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_FOUND,
+ data: payload
+ };
+ } else {
+ event = {
+ type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_EMPTY,
+ data: {}
+ };
+ }
+
+ return event;
}
function fetchSubscriptionPayload(fetchRequestCallback) {
@@ -86,26 +91,21 @@ function fetchSubscriptionPayload(fetchRequestCallback) {
return Promise.reject(new Error(response.status));
} else {
// assume 200 status
- return response;
+ return response.json();
}
}
).then(
(results)=> {
dispatch(createSubscriptionPayloadEvent(results));
-
}
).catch(
- (e) => {
- if(e.name === 'EmptyResponseException'){
- dispatch(getClearGlobalMessageEvent());
- dispatch(createSubscriptionIsEmptyEvent());
- } else{
- dispatch(getSetGlobalMessageEvent(SUBSCRIPTION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
- }
+ () => {
+ dispatch(getSetGlobalMessageEvent(SUBSCRIPTION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
}
);
};
}
+
export function getSubscriptionPayload() {
let externalfetchRequest =
() => networkCall.getRequest(SUBSCRIPTION_PAYLOAD_URL, GET);
@@ -113,6 +113,7 @@ export function getSubscriptionPayload() {
dispatch(fetchSubscriptionPayload(externalfetchRequest));
};
}
+
function validateExternalParams(externalURLParams) {
if(externalURLParams.view && externalURLParams.entityId && externalURLParams.entityType) {
return true;
@@ -121,7 +122,6 @@ function validateExternalParams(externalURLParams) {
}
-
function createSuggestionFoundEvent(suggestion) {
return {
type: contextHandlerActionTypes.SINGLE_SUGGESTION_FOUND,