spee.ch/react/components/AssetDisplay/index.js
2018-02-14 12:19:43 -08:00

29 lines
706 B
JavaScript

import { connect } from 'react-redux';
import View from './view';
import { fileRequested } from 'actions/show';
const mapStateToProps = ({ show }) => {
// select error and status
const error = show.displayAsset.error;
const status = show.displayAsset.status;
// select asset
const request = show.requestList[show.request.id];
const assetKey = request.key;
const asset = show.assetList[assetKey];
// return props
return {
error,
status,
asset,
};
};
const mapDispatchToProps = dispatch => {
return {
onFileRequest: (name, claimId) => {
dispatch(fileRequested(name, claimId));
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(View);