Skip to content

Instantly share code, notes, and snippets.

@dc198689
Created October 29, 2018 17:20
Show Gist options
  • Save dc198689/1e6998fd6df260baecfcab5c290ab75c to your computer and use it in GitHub Desktop.
Save dc198689/1e6998fd6df260baecfcab5c290ab75c to your computer and use it in GitHub Desktop.
export const stashByOptionGroups = handleActions({
ADD_STASH_BY_OPTION_GROUP: (state, action) => {
console.log('here1');
console.log(state);
if (!lang.isEmpty(state)) {
let _filter = collection.filter(state, function(findResult) {
return findResult.groupId === action.payload.groupId;
});
if (!lang.isEmpty(_filter)) {
return [
..._filter,
{
options: [
..._filter[0].options,
...action.payload.options
]
}
]
} else {
console.log('here2');
}
} else {
const options = [
...state,
action.payload
]
return options;
}
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment