lbry-desktop/ui/js/component/inviteNew/index.js

30 lines
886 B
JavaScript
Raw Normal View History

2017-08-18 05:31:44 +02:00
import React from "react";
import { connect } from "react-redux";
import InviteNew from "./view";
import {
selectUserInvitesRemaining,
selectUserInviteNewIsPending,
selectUserInviteNewErrorMessage,
2017-11-13 22:02:23 +01:00
} from "redux/selectors/user";
2017-08-26 05:21:26 +02:00
import rewards from "rewards";
2017-11-13 22:02:23 +01:00
import { makeSelectRewardAmountByType } from "redux/selectors/rewards";
2017-08-26 05:21:26 +02:00
2017-11-13 22:02:23 +01:00
import { doUserInviteNew } from "redux/actions/user";
2017-08-18 05:31:44 +02:00
2017-08-26 05:21:26 +02:00
const select = state => {
const selectReward = makeSelectRewardAmountByType();
return {
errorMessage: selectUserInviteNewErrorMessage(state),
invitesRemaining: selectUserInvitesRemaining(state),
isPending: selectUserInviteNewIsPending(state),
rewardAmount: selectReward(state, { reward_type: rewards.TYPE_REFERRAL }),
};
};
2017-08-18 05:31:44 +02:00
const perform = dispatch => ({
inviteNew: email => dispatch(doUserInviteNew(email)),
});
export default connect(select, perform)(InviteNew);