lbry-desktop/src/renderer/modal/modalRewardCode/index.js

29 lines
792 B
JavaScript
Raw Normal View History

2018-09-26 02:12:07 +02:00
// @flow
import { connect } from 'react-redux';
import { doHideNotification } from 'lbry-redux';
import {
makeSelectClaimRewardError,
doClaimRewardType,
makeSelectIsRewardClaimPending,
rewards as REWARD_TYPES,
} from 'lbryinc';
import ModalRewardCode from './view';
const select = (state): {} => ({
rewardIsPending: makeSelectIsRewardClaimPending()(state, {
reward_type: REWARD_TYPES.TYPE_REWARD_CODE,
}),
error: makeSelectClaimRewardError()(state, { reward_type: REWARD_TYPES.TYPE_REWARD_CODE }),
});
const perform = dispatch => ({
closeModal: () => dispatch(doHideNotification()),
submitRewardCode: (code: string) =>
dispatch(doClaimRewardType(REWARD_TYPES.TYPE_REWARD_CODE, null, { code })),
});
export default connect(
select,
perform
)(ModalRewardCode);