Merge pull request #1562 from lbryio/reward-claim-silent-failure

fix reward error notification
This commit is contained in:
Sean Yesmunt 2018-06-10 21:49:54 -04:00 committed by GitHub
commit 6c0e7bf8b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,7 @@ export function doRewardList() {
}; };
} }
export function doClaimRewardType(rewardType) { export function doClaimRewardType(rewardType, options) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const unclaimedRewards = selectUnclaimedRewards(state); const unclaimedRewards = selectUnclaimedRewards(state);
@ -73,7 +73,10 @@ export function doClaimRewardType(rewardType) {
const failure = error => { const failure = error => {
dispatch({ dispatch({
type: ACTIONS.CLAIM_REWARD_FAILURE, type: ACTIONS.CLAIM_REWARD_FAILURE,
data: { reward, error }, data: {
reward,
error: !options || !options.failSilently ? error : undefined,
},
}); });
}; };
@ -95,7 +98,7 @@ export function doClaimEligiblePurchaseRewards() {
dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM)); dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM));
} else { } else {
[rewards.TYPE_MANY_DOWNLOADS, rewards.TYPE_FEATURED_DOWNLOAD].forEach(type => { [rewards.TYPE_MANY_DOWNLOADS, rewards.TYPE_FEATURED_DOWNLOAD].forEach(type => {
dispatch(doClaimRewardType(type)); dispatch(doClaimRewardType(type, { failSilently: true }));
}); });
} }
}; };