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';
// export action creators
export function updateRequestWithChannelRequest (name, id) {
return {
type: actions.REQUEST_UPDATE_CHANNEL,
data: {
name,
id,
},
};
};
export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) {
return {
type : actions.REQUEST_UPDATE_CLAIM,
type: actions.REQUEST_UPDATE_CLAIM,
data: {
name,
modifier: {
id,
channelName: null,
channelId : null,
channel: {
name: channelName,
id : channelId,
},
},
extension,
},
};
};
export function updateChannelData (name, longId, shortId) {
return {
type: actions.CHANNEL_DATA_UPDATE,
data: {
name,
longId,
shortId,
},
};
};
export function updateChannelClaimsData (claims, currentPage, totalPages, totalClaims) {
return {
type: actions.CHANNEL_CLAIMS_DATA_UPDATE,
data: {
claims,
currentPage,
totalPages,
totalClaims,
},
};
};
export function updateAssetClaimData (data, shortId) {
return {
type: actions.ASSET_CLAIM_DATA_UPDATE,
data: {
data,
shortId,
},
};
};

View file

@ -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: