From 7f52c9be02b2a487a5a5440bb1bdbe07e4e28863 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 6 Feb 2018 11:55:46 -0800 Subject: [PATCH] fixed show actions to use data object --- react/actions/show.js | 49 ++++++++++++++++++++++++++---------------- react/reducers/show.js | 35 +++++------------------------- 2 files changed, 36 insertions(+), 48 deletions(-) diff --git a/react/actions/show.js b/react/actions/show.js index 4afdf978..97edaeb2 100644 --- a/react/actions/show.js +++ b/react/actions/show.js @@ -1,48 +1,61 @@ import * as actions from 'constants/show_action_types'; -// export action creators export function updateRequestWithChannelRequest (name, id) { return { type: actions.REQUEST_UPDATE_CHANNEL, - name, - id, + data: { + name, + id, + }, }; }; export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) { return { - type : actions.REQUEST_UPDATE_CLAIM, - name, - id, - channelName: null, - channelId : null, - extension, + type: actions.REQUEST_UPDATE_CLAIM, + data: { + name, + modifier: { + id, + channel: { + name: channelName, + id : channelId, + }, + }, + extension, + }, }; }; export function updateChannelData (name, longId, shortId) { return { type: actions.CHANNEL_DATA_UPDATE, - name, - longId, - shortId, + data: { + name, + longId, + shortId, + }, }; }; export function updateChannelClaimsData (claims, currentPage, totalPages, totalClaims) { return { type: actions.CHANNEL_CLAIMS_DATA_UPDATE, - claims, - currentPage, - totalPages, - totalClaims, + data: { + claims, + currentPage, + totalPages, + totalClaims, + }, }; }; export function updateAssetClaimData (data, shortId) { return { type: actions.ASSET_CLAIM_DATA_UPDATE, - data, - shortId, + data: { + data, + shortId, + }, }; }; diff --git a/react/reducers/show.js b/react/reducers/show.js index ffd75b9d..f7832aba 100644 --- a/react/reducers/show.js +++ b/react/reducers/show.js @@ -48,54 +48,29 @@ export default function (state = initialState, action) { case actions.REQUEST_UPDATE_CHANNEL: return Object.assign({}, state, { requestType : CHANNEL, - channelRequest: { - name: action.name, - id : action.id, - }, + channelRequest: action.data, }); case actions.REQUEST_UPDATE_CLAIM: return Object.assign({}, state, { requestType : ASSET, - assetRequest: { - name : action.name, - modifier: { - id : action.id, - channel: { - name: action.channelName, - id : action.channelId, - }, - }, - extension: action.extension, - }, + assetRequest: action.data, }); case actions.CHANNEL_DATA_UPDATE: return Object.assign({}, state, { showChannel: Object.assign({}, state.showChannel, { - channelData: Object.assign({}, state.channelData, { - name : action.name, - shortId: action.shortId, - longId : action.longId, - }), + channelData: action.data, }), }); case actions.CHANNEL_CLAIMS_DATA_UPDATE: return Object.assign({}, state, { showChannel: Object.assign({}, state.showChannel, { - channelClaimsData: { - claims : action.claims, - currentPage: action.currentPage, - totalPages : action.totalPages, - totalClaims: action.totalClaims, - }, + channelClaimsData: action.data, }), }); case actions.ASSET_CLAIM_DATA_UPDATE: return Object.assign({}, state, { showAsset: { - claimData: { - data : action.data, - shortId: action.shortId, - }, + claimData: action.data, }, }); default: