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.
Readarr/frontend/src/Store/Reducers/Creators/createRemoveItemReducer.js

21 lines
561 B

import _ from 'lodash';
import getSectionState from 'Utilities/State/getSectionState';
import updateSectionState from 'Utilities/State/updateSectionState';
function createRemoveItemReducer(section) {
return (state, { payload }) => {
if (section === payload.section) {
const newState = getSectionState(state, section);
newState.items = [...newState.items];
_.remove(newState.items, { id: payload.id });
return updateSectionState(state, section, newState);
}
return state;
};
}
export default createRemoveItemReducer;