2018-02-07 10:52:09 -08:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import View from './view';
|
2018-01-30 09:00:02 -08:00
|
|
|
|
2018-02-07 10:52:09 -08:00
|
|
|
const mapStateToProps = ({ show }) => {
|
2018-02-14 11:39:24 -08:00
|
|
|
// select request info
|
|
|
|
const requestId = show.request.id;
|
|
|
|
// select asset info
|
|
|
|
let asset;
|
2018-02-14 12:19:43 -08:00
|
|
|
const request = show.requestList[requestId] || null;
|
2018-02-14 11:39:24 -08:00
|
|
|
const assetList = show.assetList;
|
2018-02-14 12:09:57 -08:00
|
|
|
if (request && assetList) {
|
|
|
|
const assetKey = request.key; // note: just store this in the request
|
2018-02-14 11:39:24 -08:00
|
|
|
asset = assetList[assetKey] || null;
|
2018-02-12 20:01:02 -08:00
|
|
|
};
|
|
|
|
// return props
|
|
|
|
return {
|
2018-02-14 11:39:24 -08:00
|
|
|
asset,
|
2018-02-07 10:52:09 -08:00
|
|
|
};
|
2018-01-30 09:00:02 -08:00
|
|
|
};
|
|
|
|
|
2018-02-07 10:52:09 -08:00
|
|
|
export default connect(mapStateToProps, null)(View);
|