only call sync_apply if no wallet found

This commit is contained in:
Sean Yesmunt 2020-10-27 10:05:59 -04:00
parent 9d4f7dc642
commit d8aecaeb29

View file

@ -9,6 +9,7 @@ import { selectUserVerifiedEmail } from 'redux/selectors/user';
let syncTimer = null;
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
const NO_WALLET_ERROR = 'no wallet found for this user';
export function doSetDefaultAccount(success, failure) {
return dispatch => {
@ -231,6 +232,7 @@ export function doGetSync(passedPassword, callback) {
// call sync_apply to get data to sync
// first time sync. use any string for old hash
if (syncAttemptError.message === NO_WALLET_ERROR) {
Lbry.sync_apply({ password })
.then(({ hash: walletHash, data: syncApplyData }) => {
dispatch(doSetSync('', walletHash, syncApplyData, password));
@ -240,6 +242,7 @@ export function doGetSync(passedPassword, callback) {
handleCallback(syncApplyError);
});
}
}
});
};
}