2018-02-14 20:39:24 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import View from './view';
|
2018-01-30 18:00:02 +01:00
|
|
|
|
2018-02-14 20:39:24 +01:00
|
|
|
const mapStateToProps = ({ show }) => {
|
|
|
|
console.log('mapping state to props', show);
|
|
|
|
// select request info
|
|
|
|
const requestId = show.request.id;
|
|
|
|
// select asset info
|
|
|
|
let asset;
|
|
|
|
const previousRequest = show.assetRequests[requestId] || null;
|
|
|
|
const assetList = show.assetList;
|
|
|
|
if (previousRequest) {
|
|
|
|
const assetKey = `a#${previousRequest.name}#${previousRequest.claimId}`; // note: just store this in the request
|
|
|
|
asset = assetList[assetKey] || null;
|
|
|
|
};
|
|
|
|
// return props
|
|
|
|
return {
|
|
|
|
asset,
|
|
|
|
};
|
2018-02-13 05:01:02 +01:00
|
|
|
};
|
|
|
|
|
2018-02-14 20:39:24 +01:00
|
|
|
export default connect(mapStateToProps, null)(View);
|