update invite reward check, fix infinite reward loop

This commit is contained in:
Jeremy Kauffman 2017-09-20 15:45:39 -04:00
parent 7b41c199b2
commit cac00028c4
2 changed files with 21 additions and 15 deletions

View file

@ -47,9 +47,9 @@ class InviteList extends React.PureComponent {
<td className="text-center">
{invitee.invite_reward_claimed
? <Icon icon="icon-check" />
: invitee.invite_accepted
: invitee.invite_reward_claimable
? <RewardLink
label={__("Claim")}
label={__("claim")}
reward_type={rewards.TYPE_REFERRAL}
/>
: <span className="empty">

View file

@ -6,21 +6,27 @@ import SubHeader from "component/subHeader";
import Link from "component/link";
class RewardsPage extends React.PureComponent {
componentDidMount() {
this.fetchRewards(this.props);
}
/*
Below is broken for users who have claimed all rewards.
componentWillReceiveProps(nextProps) {
this.fetchRewards(nextProps);
}
It can safely be disabled since we fetch all rewards after authentication, but should be re-enabled once fixed.
fetchRewards(props) {
const { fetching, rewards, fetchRewards } = props;
if (!fetching && (!rewards || !rewards.length)) {
fetchRewards();
}
}
*/
// componentDidMount() {
// this.fetchRewards(this.props);
// }
//
// componentWillReceiveProps(nextProps) {
// this.fetchRewards(nextProps);
// }
//
// fetchRewards(props) {
// const { fetching, rewards, fetchRewards } = props;
//
// if (!fetching && (!rewards || !rewards.length)) {
// fetchRewards();
// }
// }
renderPageHeader() {
const { doAuth, navigate, user } = this.props;