wait to call account_balance to ensure sdk returns proper balance after claiming a reward

This commit is contained in:
Sean Yesmunt 2019-10-03 13:14:17 -04:00
parent 5aba3127c8
commit 44b6373ada
3 changed files with 66 additions and 57 deletions

3
dist/bundle.es.js vendored
View file

@ -1626,6 +1626,8 @@ function doClaimRewardType(rewardType, options = {}) {
});
const success = successReward => {
// Temporary timeout to ensure the sdk has the correct balance after claiming a reward
setTimeout(() => {
dispatch(lbryRedux.doUpdateBalance()).then(() => {
dispatch({
type: lbryRedux.ACTIONS.CLAIM_REWARD_SUCCESS,
@ -1646,6 +1648,7 @@ function doClaimRewardType(rewardType, options = {}) {
options.callback();
}
});
}, 1000);
};
const failure = error => {

3
dist/bundle.js vendored
View file

@ -2186,6 +2186,8 @@ function doClaimRewardType(rewardType) {
});
var success = function success(successReward) {
// Temporary timeout to ensure the sdk has the correct balance after claiming a reward
setTimeout(function () {
dispatch(Object(lbry_redux__WEBPACK_IMPORTED_MODULE_1__["doUpdateBalance"])()).then(function () {
dispatch({
type: lbry_redux__WEBPACK_IMPORTED_MODULE_1__["ACTIONS"].CLAIM_REWARD_SUCCESS,
@ -2206,6 +2208,7 @@ function doClaimRewardType(rewardType) {
options.callback();
}
});
}, 1000);
};
var failure = function failure(error) {

View file

@ -71,6 +71,8 @@ export function doClaimRewardType(rewardType, options = {}) {
});
const success = successReward => {
// Temporary timeout to ensure the sdk has the correct balance after claiming a reward
setTimeout(() => {
dispatch(doUpdateBalance()).then(() => {
dispatch({
type: ACTIONS.CLAIM_REWARD_SUCCESS,
@ -93,6 +95,7 @@ export function doClaimRewardType(rewardType, options = {}) {
options.callback();
}
});
}, 1000);
};
const failure = error => {