madiator.com/ui/modal/modalRewardCode/index.js

22 lines
795 B
JavaScript
Raw Normal View History

2021-08-16 12:11:25 +02:00
import REWARDS from 'rewards';
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import { doClaimRewardType } from 'redux/actions/rewards';
import { makeSelectClaimRewardError, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
import ModalRewardCode from './view';
const select = state => ({
rewardIsPending: makeSelectIsRewardClaimPending()(state, {
reward_type: REWARDS.TYPE_REWARD_CODE,
}),
error: makeSelectClaimRewardError()(state, { reward_type: REWARDS.TYPE_REWARD_CODE }),
});
const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()),
submitRewardCode: code => dispatch(doClaimRewardType(REWARDS.TYPE_REWARD_CODE, { params: { code } })),
});
export default connect(select, perform)(ModalRewardCode);