You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import _ from 'lodash';
|
|
|
|
import getSectionState from 'Utilities/State/getSectionState';
|
|
|
|
import updateSectionState from 'Utilities/State/updateSectionState';
|
|
|
|
|
|
|
|
const blacklistedProperties = [
|
|
|
|
'section',
|
|
|
|
'id'
|
|
|
|
];
|
|
|
|
|
|
|
|
function createSetReducer(section) {
|
|
|
|
return (state, { payload }) => {
|
|
|
|
if (section === payload.section) {
|
|
|
|
const newState = Object.assign(getSectionState(state, section),
|
|
|
|
_.omit(payload, blacklistedProperties));
|
|
|
|
|
|
|
|
return updateSectionState(state, section, newState);
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default createSetReducer;
|