feat(sync): store.updateTarget() to edit a saved target

This commit is contained in:
iamdoubz
2026-07-06 10:41:01 -05:00
parent 45b2acbbc6
commit 496a3372c4
+20
View File
@@ -248,6 +248,19 @@ class SettingsStore {
await this.loadPrivacy();
}
async updateTarget(config: SyncTargetConfig & { id: string }) {
try {
const updated = await api.updateSyncTarget(config);
this.targets = this.targets.map((t) => (t.id === config.id ? updated : t));
} catch {
this.backendStub = true;
this.targets = this.targets.map((t) =>
t.id === config.id ? { ...t, ...stubTarget(config), id: config.id } : t,
);
}
await this.loadPrivacy();
}
async removeTarget(id: string) {
this.targets = this.targets.filter((t) => t.id !== id);
try {
@@ -297,6 +310,13 @@ function stubTarget(c: SyncTargetConfig): SyncTargetInfo {
enabled: c.enabled ?? false,
third_party: c.kind !== "webdav",
host,
upload_transcript: c.upload_transcript ?? true,
upload_notes: c.upload_notes ?? true,
upload_summary: c.upload_summary ?? true,
upload_recording: c.upload_recording ?? false,
trigger_on_finalize: c.trigger_on_finalize ?? true,
allow_plaintext_lan: c.allow_plaintext_lan ?? false,
encrypt_before_upload: c.encrypt_before_upload ?? false,
};
}