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

30 lines
711 B
JavaScript
Raw Normal View History

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 05:01:02 +01:00
// select error and status
const error = show.displayAsset.error;
const status = show.displayAsset.status;
// select asset
2018-02-14 21:09:57 +01:00
const request = show.previousRequests[show.request.id];
const assetKey = request.key;
2018-02-13 03:50:19 +01:00
const asset = show.assetList[assetKey];
2018-02-13 05:01:02 +01:00
// return props
return {
error,
status,
asset,
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);