2018-09-26 02:12:07 +02:00
|
|
|
// @flow
|
|
|
|
import { connect } from 'react-redux';
|
2018-10-29 18:25:22 +01:00
|
|
|
import { doHideNotification } from 'lbry-redux';
|
2018-09-26 02:12:07 +02:00
|
|
|
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 => ({
|
2018-10-29 18:25:22 +01:00
|
|
|
closeModal: () => dispatch(doHideNotification()),
|
2018-09-26 02:12:07 +02:00
|
|
|
submitRewardCode: (code: string) =>
|
2018-10-02 02:55:03 +02:00
|
|
|
dispatch(doClaimRewardType(REWARD_TYPES.TYPE_REWARD_CODE, { params: { code } })),
|
2018-09-26 02:12:07 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(ModalRewardCode);
|