use rest spread operator in reducers

This commit is contained in:
Travis Eden 2018-09-24 15:42:57 -04:00
parent e25715f2cc
commit b937a44e91

View file

@ -74,24 +74,34 @@ export default function (state = initialState, action) {
const channelClaims = state.channelList[channelId].claimsData.claims;
const newClaimsData = channelClaims.filter(c => c.claimId !== claim.claimId);
return Object.assign({}, state, {
return {
...state,
assetList : newAssetList,
channelList: Object.assign({}, state.channelList, {
[channelId]: Object.assign({}, state.channelList[channelId], {
claimsData: Object.assign({}, state.channelList[channelId].claimsData, {
channelList: {
...state.channelList,
[channelId]: {
...state.channelList[channelId],
claimsData: {
...state.channelList[channelId].claimsData,
claims: newClaimsData,
}),
}),
}),
});
},
},
},
};
case actions.ASSET_UPDATE_CLAIMDATA:
return Object.assign({}, state, {
assetList: Object.assign({}, state.assetList, {
[action.data.id]: Object.assign({}, state.assetList[action.data.id], {
claimData: Object.assign({}, state.assetList[action.data.id].claimData, action.data.claimData),
}),
}),
});
return {
...state,
assetList: {
...state.assetList,
[action.data.id]: {
...state.assetList[action.data.id],
claimData: {
...state.assetList[action.data.id].claimData,
...action.data.claimData,
},
},
},
};
// channel data
case actions.CHANNEL_ADD:
return Object.assign({}, state, {