From b937a44e91436bc767e6375c114682abb19e6768 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Mon, 24 Sep 2018 15:42:57 -0400 Subject: [PATCH] use rest spread operator in reducers --- client/src/reducers/show.js | 40 +++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/client/src/reducers/show.js b/client/src/reducers/show.js index ded05015..da80ed75 100644 --- a/client/src/reducers/show.js +++ b/client/src/reducers/show.js @@ -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, {