2018-02-07 04:00:52 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import View from './view';
|
|
|
|
import { fileRequested } from 'actions/show';
|
|
|
|
|
|
|
|
const mapStateToProps = ({ show }) => {
|
2018-02-13 03:18:56 +01:00
|
|
|
let props = {
|
|
|
|
error : show.displayAsset.error,
|
|
|
|
status: show.displayAsset.status,
|
|
|
|
};
|
|
|
|
// select asset info
|
|
|
|
const existingRequest = show.assetRequests[show.request.id];
|
|
|
|
const assetKey = `a#${existingRequest.name}#${existingRequest.claimId}`;
|
|
|
|
const existingAsset = show.assetList[assetKey];
|
|
|
|
if (existingAsset) {
|
|
|
|
props['asset'] = existingAsset;
|
2018-02-07 04:00:52 +01:00
|
|
|
};
|
2018-02-13 03:18:56 +01:00
|
|
|
return props;
|
2018-02-07 04:00:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
|
|
|
onFileRequest: (name, claimId) => {
|
|
|
|
dispatch(fileRequested(name, claimId));
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(View);
|