2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
24 } from 'app/networking/NetworkConstants.js';
25 import networkCall from 'app/networking/NetworkCalls.js';
27 GET_PERSONALIZED_VALUES_URL,
28 PERSONALIZATION_FAILED_MESSAGE,
29 personalizationActionTypes
30 } from 'app/personlaization/PersonalizationConstans.js';
32 getSetGlobalMessageEvent
33 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
36 STATUS_CODE_5XX_SERVER_ERROR,
38 } from 'utils/GlobalConstants.js';
41 function createPersonalizedValuesEvent(payload) {
44 type: personalizationActionTypes.PERSONALIZATION_PAYLOAD_FOUND,
50 function fetchPersonalizedValues(fetchRequestCallback) {
52 return fetchRequestCallback().then(
54 if (response.status >= STATUS_CODE_5XX_SERVER_ERROR) {
55 dispatch(getSetGlobalMessageEvent(PERSONALIZATION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
58 //for localonly do not commit
59 //dispatch(createPersonalizedValuesEvent(response));
60 return response.json();
65 dispatch(createPersonalizedValuesEvent(results));
69 dispatch(getSetGlobalMessageEvent(PERSONALIZATION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
75 export function getPersonalizationDetails(){
76 let personalizationFetchRequest =
77 () => networkCall.getRequest(GET_PERSONALIZED_VALUES_URL, GET);
79 return dispatch => dispatch(fetchPersonalizedValues(personalizationFetchRequest));