2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { makeSelectRewardByClaimCode, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
|
|
|
|
import { doClaimRewardType } from 'redux/actions/rewards';
|
|
|
|
|
2017-12-21 22:08:54 +01:00
|
|
|
import RewardLink from './view';
|
2017-05-26 10:53:32 +02:00
|
|
|
|
2019-01-17 07:34:31 +01:00
|
|
|
const select = (state, props) => ({
|
|
|
|
isPending: makeSelectIsRewardClaimPending()(state, props),
|
2020-03-26 20:14:22 +01:00
|
|
|
reward: makeSelectRewardByClaimCode()(state, props.claim_code),
|
2019-01-17 07:34:31 +01:00
|
|
|
});
|
2017-05-26 10:53:32 +02:00
|
|
|
|
2017-06-08 02:56:52 +02:00
|
|
|
const perform = dispatch => ({
|
2020-03-28 02:54:59 +01:00
|
|
|
claimReward: reward =>
|
|
|
|
dispatch(doClaimRewardType(reward.reward_type, { notifyError: true, params: { claim_code: reward.claim_code } })),
|
2017-06-08 02:56:52 +02:00
|
|
|
});
|
2017-05-26 10:53:32 +02:00
|
|
|
|
2020-03-26 20:14:22 +01:00
|
|
|
export default connect(select, perform)(RewardLink);
|