...
|
...
|
@@ -13,6 +13,14 @@ const { |
|
|
GET_OUTLETHOMERESOURCE_SUCCESS,
|
|
|
GET_OUTLETHOMERESOURCE_FAILURE,
|
|
|
|
|
|
GET_PRODUCT_REQUEST,
|
|
|
GET_PRODUCT_SUCCESS,
|
|
|
GET_PRODUCT_FAILURE,
|
|
|
|
|
|
GET_OUTLET_ACTIVITY_LIST_REQUEST,
|
|
|
GET_OUTLET_ACTIVITY_LIST_SUCCESS,
|
|
|
GET_OUTLET_ACTIVITY_LIST_FAILURE,
|
|
|
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
|
|
const initialState = new InitialState;
|
...
|
...
|
@@ -46,12 +54,24 @@ export default function outletReducer(state=initialState, action) { |
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_OUTLETHOMERESOURCE_SUCCESS: {
|
|
|
let categoryNavigationList;
|
|
|
|
|
|
if (action.payload.json.list) {
|
|
|
action.payload.json.list.map((item, i) => {
|
|
|
let template_name = item.template_name;
|
|
|
if (template_name == 'categoryNavigation') {
|
|
|
categoryNavigationList = item.data;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let categoryList = state.categoryList.toJS();
|
|
|
let content_code1 = action.payload.json.content_code?action.payload.json.content_code:action.payload.content_code;
|
|
|
let content_code1 = action.payload.content_code;
|
|
|
categoryList.list.map((item, i) => {
|
|
|
let content_code0 = item.content_code;
|
|
|
if (content_code1 == content_code0) {
|
|
|
item.honeResource = action.payload.json;
|
|
|
item.categoryNavigationList = categoryNavigationList;
|
|
|
item.isFetching = false;
|
|
|
item.error = '';
|
|
|
item.ptr = false;
|
...
|
...
|
@@ -73,6 +93,84 @@ export default function outletReducer(state=initialState, action) { |
|
|
})
|
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_PRODUCT_REQUEST: {
|
|
|
let categoryList = state.categoryList.toJS();
|
|
|
let content_code1 = action.payload.content_code;
|
|
|
let categoryNavigationItem = action.payload.categoryNavigationItem;
|
|
|
|
|
|
categoryList.list.map((item, i) => {
|
|
|
let content_code0 = item.content_code;
|
|
|
if (content_code1 == content_code0) {
|
|
|
item.categoryNavigationList.map((item0, i) => {
|
|
|
let categoryName = item0.categoryName;
|
|
|
if (categoryNavigationItem.categoryName == categoryName) {
|
|
|
item0.isFetching = true;
|
|
|
item0.error = null;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_PRODUCT_SUCCESS: {
|
|
|
let categoryList = state.categoryList.toJS();
|
|
|
let content_code1 = action.payload.content_code;
|
|
|
let categoryNavigationItem = action.payload.categoryNavigationItem;
|
|
|
|
|
|
categoryList.list.map((item, i) => {
|
|
|
let content_code0 = item.content_code;
|
|
|
if (content_code1 == content_code0) {
|
|
|
item.categoryNavigationList.map((item0, i) => {
|
|
|
let categoryName = item0.categoryName;
|
|
|
if (categoryNavigationItem.categoryName == categoryName) {
|
|
|
item0.list = action.payload.json;
|
|
|
item0.isFetching = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_PRODUCT_FAILURE: {
|
|
|
let categoryList = state.categoryList.toJS();
|
|
|
let content_code1 = action.payload.content_code;
|
|
|
let categoryNavigationItem = action.payload.categoryNavigationItem;
|
|
|
let error = action.payload.error;
|
|
|
|
|
|
categoryList.list.map((item, i) => {
|
|
|
let content_code0 = item.content_code;
|
|
|
if (content_code1 == content_code0) {
|
|
|
item.categoryNavigationList.map((item0, i) => {
|
|
|
let categoryName = item0.categoryName;
|
|
|
if (categoryNavigationItem.categoryName == categoryName) {
|
|
|
item0.isFetching = false;
|
|
|
item0.error = error;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_OUTLET_ACTIVITY_LIST_REQUEST: {
|
|
|
|
|
|
}
|
|
|
case GET_OUTLET_ACTIVITY_LIST_SUCCESS: {
|
|
|
let categoryList = state.categoryList.toJS();
|
|
|
let content_code1 = action.payload.content_code;
|
|
|
categoryList.list.map((item, i) => {
|
|
|
let content_code0 = item.content_code;
|
|
|
if (content_code1 == content_code0) {
|
|
|
item.activityList = action.payload.json;
|
|
|
}
|
|
|
})
|
|
|
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
|
|
|
}
|
|
|
case GET_OUTLET_ACTIVITY_LIST_FAILURE: {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return state;
|
...
|
...
|
|