Merge pull request #41 from lbryio/autoclaim-rewards

auto claim eligible rewards after viewing a file
This commit is contained in:
Akinwale Ariwodola 2019-09-12 07:20:02 +01:00 committed by GitHub
commit 9e8ba95fec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -25,6 +25,7 @@ import {
selectPurchaseUriErrorMessage,
} from 'lbry-redux';
import {
doClaimEligiblePurchaseRewards,
doFetchCostInfoForUri,
makeSelectCostInfoForUri,
selectRewardContentClaimIds,
@ -69,6 +70,7 @@ const select = (state, props) => {
};
const perform = dispatch => ({
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
},

View file

@ -477,6 +477,7 @@ class FilePage extends React.PureComponent {
return;
}
const { claimEligibleRewards } = this.props;
const { nout, claim_id: claimId, txid } = claim;
const outpoint = `${txid}:${nout}`;
const params = {
@ -488,7 +489,9 @@ class FilePage extends React.PureComponent {
params.time_to_start = timeToStart;
}
Lbryio.call('file', 'view', params).catch(() => {});
Lbryio.call('file', 'view', params)
.then(() => claimEligibleRewards())
.catch(() => {});
this.setState({ fileViewLogged: true });
};