fetchUser refresh on rewards header

This commit is contained in:
jessop 2019-10-14 16:18:16 -04:00 committed by Sean Yesmunt
parent 194464bd71
commit 8b0b69d7dc
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,12 @@
import { connect } from 'react-redux';
import { selectFetchingRewards, selectUnclaimedRewards, selectClaimedRewards, selectUser, doRewardList } from 'lbryinc';
import {
selectFetchingRewards,
selectUnclaimedRewards,
selectClaimedRewards,
selectUser,
doRewardList,
doUserFetch,
} from 'lbryinc';
import { selectDaemonSettings } from 'redux/selectors/settings';
import RewardsPage from './view';
@ -13,6 +20,7 @@ const select = state => ({
const perform = dispatch => ({
fetchRewards: () => dispatch(doRewardList()),
fetchUser: () => dispatch(doUserFetch()),
});
export default connect(

View file

@ -12,6 +12,7 @@ import { rewards as REWARD_TYPES } from 'lbryinc';
type Props = {
doAuth: () => void,
fetchRewards: () => void,
fetchUser: () => void,
fetching: boolean,
rewards: Array<Reward>,
claimed: Array<Reward>,
@ -31,7 +32,7 @@ class RewardsPage extends PureComponent<Props> {
this.props.fetchRewards();
}
renderPageHeader() {
const { user, daemonSettings } = this.props;
const { user, daemonSettings, fetchUser } = this.props;
if (user && !user.is_reward_approved && daemonSettings && daemonSettings.share_usage_data) {
if (!user.primary_email || !user.has_verified_email || !user.is_identity_verified) {
@ -69,6 +70,7 @@ class RewardsPage extends PureComponent<Props> {
</p>
<div className="card__actions">
<Button navigate="/" button="primary" label="Return Home" />
<Button onClick={() => fetchUser()} button="link" label="Refresh" />
</div>
</section>
);