web: check for internet reachability before sync

This commit is contained in:
Abdullah Atta
2023-07-04 16:43:40 +05:00
parent cdb3ede207
commit 60667149d4

View File

@@ -287,8 +287,13 @@ class AppStore extends BaseStore {
};
sync = async (full = true, force = false) => {
if (!this.get().isSyncEnabled || !navigator.onLine) return;
if (this.isSyncing()) return;
if (
this.isSyncing() ||
!this.get().isSyncEnabled ||
!navigator.onLine ||
!(await networkCheck.waitForInternet())
)
return;
clearTimeout(syncStatusTimeout);
this.updateLastSynced();