@@ -22,7 +22,7 @@ export const buildCollectionReducers = (actionTypes, keyName) => {
22
22
23
23
// Reducer to SET a list of objects in the store
24
24
const setReducer = ( state , payload ) => {
25
- const filteredPayload = filterByKeyname ( asArray ( payload [ 0 ] ) , keyName ) ;
25
+ const filteredPayload = filterByKeyname ( asArray ( payload ) , keyName ) ;
26
26
const setIndexes = getKeyNameValues ( filteredPayload , keyName ) ;
27
27
28
28
return [
@@ -35,7 +35,7 @@ export const buildCollectionReducers = (actionTypes, keyName) => {
35
35
36
36
// Reducer to UPDATE a list of objects in the store
37
37
const updateReducer = ( state , payload ) => {
38
- const filteredPayload = filterByKeyname ( asArray ( payload [ 0 ] ) , keyName ) ;
38
+ const filteredPayload = filterByKeyname ( asArray ( payload ) , keyName ) ;
39
39
const updateIndexes = getKeyNameValues ( filteredPayload , keyName ) ;
40
40
const existingIndexes = getKeyNameValues ( state , keyName ) ;
41
41
@@ -55,7 +55,7 @@ export const buildCollectionReducers = (actionTypes, keyName) => {
55
55
56
56
// Reducer to DELETE a list of objects in the store
57
57
const deleteReducer = ( state , payload ) => {
58
- const filteredPayload = filterByKeyname ( asArray ( payload [ 0 ] ) , keyName ) ;
58
+ const filteredPayload = filterByKeyname ( asArray ( payload ) , keyName ) ;
59
59
const setIndexes = getKeyNameValues ( filteredPayload , keyName ) ;
60
60
61
61
return [
@@ -81,7 +81,7 @@ export const buildSimpleReducer = actionTypes => {
81
81
const { SET } = actionTypes ;
82
82
83
83
// Reducer to SET a list of objects in the store
84
- const setReducer = ( _ , payload ) => payload [ 0 ] ;
84
+ const setReducer = ( _ , payload ) => payload ;
85
85
86
86
return {
87
87
[ SET ] : setReducer ,
@@ -94,7 +94,7 @@ export const buildArrayReducers = (actionTypes, keyName) => {
94
94
const popReducer = state => state . slice ( 0 , state . length - 1 ) ;
95
95
const unshiftReducer = ( state , payload ) => [ ...payload , ...state ] ;
96
96
const shiftReducer = state => state . slice ( 1 , state . length ) ;
97
- const deleteReducer = ( state , payload ) => state . filter ( ( _ , i ) => i !== payload [ 0 ] ) ;
97
+ const deleteReducer = ( state , payload ) => state . filter ( ( _ , i ) => i !== payload ) ;
98
98
const insertReducer = ( state , payload ) => {
99
99
let a = [ ...state ] ;
100
100
a . splice ( payload [ 1 ] , 0 , payload [ 0 ] ) ;
0 commit comments