spee.ch/react/components/ShowAssetDetails/index.js

22 lines
549 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import View from './view';
const mapStateToProps = ({ show }) => {
// select request info
const requestId = show.request.id;
// select asset info
let asset;
const request = show.requestList[requestId] || null;
const assetList = show.assetList;
2018-02-14 21:09:57 +01:00
if (request && assetList) {
const assetKey = request.key; // note: just store this in the request
asset = assetList[assetKey] || null;
};
// return props
return {
asset,
};
2018-02-13 05:01:02 +01:00
};
export default connect(mapStateToProps, null)(View);