use rest spread operator in reducers
This commit is contained in:
parent
e25715f2cc
commit
b937a44e91
1 changed files with 25 additions and 15 deletions
|
@ -74,24 +74,34 @@ export default function (state = initialState, action) {
|
||||||
const channelClaims = state.channelList[channelId].claimsData.claims;
|
const channelClaims = state.channelList[channelId].claimsData.claims;
|
||||||
const newClaimsData = channelClaims.filter(c => c.claimId !== claim.claimId);
|
const newClaimsData = channelClaims.filter(c => c.claimId !== claim.claimId);
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return {
|
||||||
|
...state,
|
||||||
assetList : newAssetList,
|
assetList : newAssetList,
|
||||||
channelList: Object.assign({}, state.channelList, {
|
channelList: {
|
||||||
[channelId]: Object.assign({}, state.channelList[channelId], {
|
...state.channelList,
|
||||||
claimsData: Object.assign({}, state.channelList[channelId].claimsData, {
|
[channelId]: {
|
||||||
|
...state.channelList[channelId],
|
||||||
|
claimsData: {
|
||||||
|
...state.channelList[channelId].claimsData,
|
||||||
claims: newClaimsData,
|
claims: newClaimsData,
|
||||||
}),
|
},
|
||||||
}),
|
},
|
||||||
}),
|
},
|
||||||
});
|
};
|
||||||
case actions.ASSET_UPDATE_CLAIMDATA:
|
case actions.ASSET_UPDATE_CLAIMDATA:
|
||||||
return Object.assign({}, state, {
|
return {
|
||||||
assetList: Object.assign({}, state.assetList, {
|
...state,
|
||||||
[action.data.id]: Object.assign({}, state.assetList[action.data.id], {
|
assetList: {
|
||||||
claimData: Object.assign({}, state.assetList[action.data.id].claimData, action.data.claimData),
|
...state.assetList,
|
||||||
}),
|
[action.data.id]: {
|
||||||
}),
|
...state.assetList[action.data.id],
|
||||||
});
|
claimData: {
|
||||||
|
...state.assetList[action.data.id].claimData,
|
||||||
|
...action.data.claimData,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
// channel data
|
// channel data
|
||||||
case actions.CHANNEL_ADD:
|
case actions.CHANNEL_ADD:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
|
Loading…
Reference in a new issue