Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: update database sync api to use new sync options

Abdullah Attaa4e777b24bc2
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js
index ad0f24cb1..912a7526a 100644
--- a/apps/web/src/stores/app-store.js
+++ b/apps/web/src/stores/app-store.js
@@ -298,7 +298,11 @@ class AppStore extends BaseStore {
this.updateSyncStatus("syncing");
try {
- const result = await db.sync(full, force, lastSynced);
+ const result = await db.sync({
+ type: full ? "full" : "send",
+ force,
+ serverLastSynced: lastSynced
+ });
if (!result) return this.updateSyncStatus("failed");
this.updateSyncStatus("completed", true);
@@ -307,7 +311,6 @@ class AppStore extends BaseStore {
if (pendingSync) {
logger.info("Running pending sync", pendingSync);
- pendingSync = false;
await this.get().sync(pendingSync.full, false);
}
} catch (err) {
diff --git a/apps/web/src/views/recovery.tsx b/apps/web/src/views/recovery.tsx
index c846b9021..e68ff01f1 100644
--- a/apps/web/src/views/recovery.tsx
+++ b/apps/web/src/views/recovery.tsx
@@ -358,7 +358,7 @@ function RecoveryKeyMethod(props: BaseRecoveryComponentProps<"method:key">) {
const user = await db.user?.getUser();
if (!user) throw new Error("User not authenticated");
await db.storage?.write(`_uk_@${user.email}@_k`, form.recoveryKey);
- await db.sync(true, true);
+ await db.sync({ type: "fetch", force: true });
navigate("backup");
}}
>
@@ -507,7 +507,7 @@ function NewPassword(props: BaseRecoveryComponentProps<"new">) {
if (formData?.backupFile) {
await restoreBackupFile(formData?.backupFile);
- await db.sync(true, true);
+ await db.sync({ type: "full", force: true });
}
navigate("final");