lbry-desktop/ui/modal/modalRewardCode/index.js

22 lines
795 B
JavaScript
Raw Permalink Normal View History

import REWARDS from 'rewards';
2018-09-26 02:12:07 +02:00
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import { doClaimRewardType } from 'redux/actions/rewards';
import { makeSelectClaimRewardError, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
2018-09-26 02:12:07 +02:00
import ModalRewardCode from './view';
2019-03-18 06:09:50 +01:00
const select = state => ({
2018-09-26 02:12:07 +02:00
rewardIsPending: makeSelectIsRewardClaimPending()(state, {
reward_type: REWARDS.TYPE_REWARD_CODE,
2018-09-26 02:12:07 +02:00
}),
error: makeSelectClaimRewardError()(state, { reward_type: REWARDS.TYPE_REWARD_CODE }),
2018-09-26 02:12:07 +02:00
});
const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()),
submitRewardCode: code => dispatch(doClaimRewardType(REWARDS.TYPE_REWARD_CODE, { params: { code } })),
2018-09-26 02:12:07 +02:00
});
export default connect(select, perform)(ModalRewardCode);