A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: do not throw on sync already running
thecodrre0202cd22ad5
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.jsindex 478b283ba..3f9c6eb54 100644--- a/packages/core/api/sync/index.js+++ b/packages/core/api/sync/index.js@@ -53,10 +53,8 @@ export default class Sync {}async _performChecks() {- if (this._isSyncing) throw new Error("Sync already running.");let lastSynced = (await this._db.context.read("lastSynced")) || 0;let token = await this._tokenManager.getAccessToken();- if (!token) throw new Error("You need to login to sync.");// update the conflicts status and if find any, throwawait this._db.conflicts.recalculate();@@ -66,6 +64,8 @@ export default class Sync {}async start(full, force) {+ if (this._isSyncing) return false;+if (force) await this._db.context.write("lastSynced", 0);let { lastSynced, token } = await this._performChecks();@@ -94,6 +94,8 @@ export default class Sync {if (lastSynced) {await this._db.context.write("lastSynced", lastSynced);}++ return true;} catch (e) {throw e;} finally {diff --git a/packages/core/api/token-manager.js b/packages/core/api/token-manager.jsindex f81154de1..fee82ba69 100644--- a/packages/core/api/token-manager.js+++ b/packages/core/api/token-manager.js@@ -45,7 +45,7 @@ class TokenManager {if (e.message === "invalid_grant" || e.message === "invalid_client") {EV.publish(EVENTS.userSessionExpired);}- return null;+ throw e;}}