mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-19 21:46:43 -04:00
4c622fd412
Closes #6887
26 lines
806 B
JavaScript
26 lines
806 B
JavaScript
import getSectionState from 'Utilities/State/getSectionState';
|
|
import updateSectionState from 'Utilities/State/updateSectionState';
|
|
|
|
function createSetProviderFieldValuesReducer(section) {
|
|
return (state, { payload }) => {
|
|
if (section === payload.section) {
|
|
const { properties } = payload;
|
|
const newState = getSectionState(state, section);
|
|
newState.pendingChanges = Object.assign({}, newState.pendingChanges);
|
|
const fields = Object.assign({}, newState.pendingChanges.fields || {});
|
|
|
|
Object.keys(properties).forEach((name) => {
|
|
fields[name] = properties[name];
|
|
});
|
|
|
|
newState.pendingChanges.fields = fields;
|
|
|
|
return updateSectionState(state, section, newState);
|
|
}
|
|
|
|
return state;
|
|
};
|
|
}
|
|
|
|
export default createSetProviderFieldValuesReducer;
|