Created
October 29, 2018 17:20
-
-
Save dc198689/1e6998fd6df260baecfcab5c290ab75c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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