fixed show actions to use data object

This commit is contained in:
bill bittner 2018-02-06 11:55:46 -08:00
parent cb871cae36
commit 7f52c9be02
2 changed files with 36 additions and 48 deletions

View file

@ -1,48 +1,61 @@
import * as actions from 'constants/show_action_types'; import * as actions from 'constants/show_action_types';
// export action creators
export function updateRequestWithChannelRequest (name, id) { export function updateRequestWithChannelRequest (name, id) {
return { return {
type: actions.REQUEST_UPDATE_CHANNEL, type: actions.REQUEST_UPDATE_CHANNEL,
data: {
name, name,
id, id,
},
}; };
}; };
export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) { export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) {
return { return {
type: actions.REQUEST_UPDATE_CLAIM, type: actions.REQUEST_UPDATE_CLAIM,
data: {
name, name,
modifier: {
id, id,
channelName: null, channel: {
channelId : null, name: channelName,
id : channelId,
},
},
extension, extension,
},
}; };
}; };
export function updateChannelData (name, longId, shortId) { export function updateChannelData (name, longId, shortId) {
return { return {
type: actions.CHANNEL_DATA_UPDATE, type: actions.CHANNEL_DATA_UPDATE,
data: {
name, name,
longId, longId,
shortId, shortId,
},
}; };
}; };
export function updateChannelClaimsData (claims, currentPage, totalPages, totalClaims) { export function updateChannelClaimsData (claims, currentPage, totalPages, totalClaims) {
return { return {
type: actions.CHANNEL_CLAIMS_DATA_UPDATE, type: actions.CHANNEL_CLAIMS_DATA_UPDATE,
data: {
claims, claims,
currentPage, currentPage,
totalPages, totalPages,
totalClaims, totalClaims,
},
}; };
}; };
export function updateAssetClaimData (data, shortId) { export function updateAssetClaimData (data, shortId) {
return { return {
type: actions.ASSET_CLAIM_DATA_UPDATE, type: actions.ASSET_CLAIM_DATA_UPDATE,
data: {
data, data,
shortId, shortId,
},
}; };
}; };

View file

@ -48,54 +48,29 @@ export default function (state = initialState, action) {
case actions.REQUEST_UPDATE_CHANNEL: case actions.REQUEST_UPDATE_CHANNEL:
return Object.assign({}, state, { return Object.assign({}, state, {
requestType : CHANNEL, requestType : CHANNEL,
channelRequest: { channelRequest: action.data,
name: action.name,
id : action.id,
},
}); });
case actions.REQUEST_UPDATE_CLAIM: case actions.REQUEST_UPDATE_CLAIM:
return Object.assign({}, state, { return Object.assign({}, state, {
requestType : ASSET, requestType : ASSET,
assetRequest: { assetRequest: action.data,
name : action.name,
modifier: {
id : action.id,
channel: {
name: action.channelName,
id : action.channelId,
},
},
extension: action.extension,
},
}); });
case actions.CHANNEL_DATA_UPDATE: case actions.CHANNEL_DATA_UPDATE:
return Object.assign({}, state, { return Object.assign({}, state, {
showChannel: Object.assign({}, state.showChannel, { showChannel: Object.assign({}, state.showChannel, {
channelData: Object.assign({}, state.channelData, { channelData: action.data,
name : action.name,
shortId: action.shortId,
longId : action.longId,
}),
}), }),
}); });
case actions.CHANNEL_CLAIMS_DATA_UPDATE: case actions.CHANNEL_CLAIMS_DATA_UPDATE:
return Object.assign({}, state, { return Object.assign({}, state, {
showChannel: Object.assign({}, state.showChannel, { showChannel: Object.assign({}, state.showChannel, {
channelClaimsData: { channelClaimsData: action.data,
claims : action.claims,
currentPage: action.currentPage,
totalPages : action.totalPages,
totalClaims: action.totalClaims,
},
}), }),
}); });
case actions.ASSET_CLAIM_DATA_UPDATE: case actions.ASSET_CLAIM_DATA_UPDATE:
return Object.assign({}, state, { return Object.assign({}, state, {
showAsset: { showAsset: {
claimData: { claimData: action.data,
data : action.data,
shortId: action.shortId,
},
}, },
}); });
default: default: