web: update database sync api to use new sync options

This commit is contained in:
Abdullah Atta
2023-11-02 12:25:07 +05:00
committed by Abdullah Atta
parent af7120e953
commit a4e777b24b
2 changed files with 7 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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");