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

39 lines
1.1 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import View from './view';
2018-02-07 22:26:07 +01:00
import { newAssetRequest, updateAssetClaimData, updateShowAssetError } from 'actions/show';
const mapStateToProps = ({ show }) => {
return {
2018-02-07 22:26:07 +01:00
// new
request : show.assetRequest,
assetRequests: show.assetRequests,
extension : show.assetRequest.extension,
// old
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 {
2018-02-07 22:26:07 +01:00
// new
onNewAssetRequest (name, modifier) {
dispatch(newAssetRequest(name, modifier));
},
// old
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);