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.
17 lines
429 B
17 lines
429 B
function updateSectionState(state, section, newState) {
|
|
const [, subSection] = section.split('.');
|
|
|
|
if (subSection) {
|
|
return Object.assign({}, state, { [subSection]: newState });
|
|
}
|
|
|
|
// TODO: Remove in favour of using subSection
|
|
if (state.hasOwnProperty(section)) {
|
|
return Object.assign({}, state, { [section]: newState });
|
|
}
|
|
|
|
return Object.assign({}, state, newState);
|
|
}
|
|
|
|
export default updateSectionState;
|