only call sync_apply if no wallet found
This commit is contained in:
parent
9d4f7dc642
commit
d8aecaeb29
1 changed files with 11 additions and 8 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue