spee.ch/react/containers/ShowAsset/index.js

32 lines
960 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import View from './view';
import { updateAssetClaimData, updateShowAssetError } from 'actions/show';
const mapStateToProps = ({ show }) => {
return {
modifier : show.assetRequest.modifier,
name : show.assetRequest.name,
extension: show.assetRequest.extension,
error : show.showAsset.error,
2018-02-07 04:00:52 +01:00
claimData: show.showAsset.claimData,
};
};
2018-02-03 03:16:18 +01:00
const mapDispatchToProps = dispatch => {
return {
onShowAssetError: (error) => {
dispatch(updateShowAssetError(error));
},
2018-02-05 02:43:02 +01:00
onAssetClaimDataUpdate: (claimData, shortId) => {
dispatch(updateAssetClaimData(claimData, shortId));
dispatch(updateShowAssetError(null)); // clear any errors
2018-02-03 03:16:18 +01:00
},
onAssetClaimDataClear: () => {
2018-02-05 02:43:02 +01:00
dispatch(updateAssetClaimData(null, null));
dispatch(updateShowAssetError(null)); // clear any errors
2018-02-03 03:16:18 +01:00
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(View);