fix: preserve committed backup creation success
This commit is contained in:
@@ -20,6 +20,14 @@ function sanitizeEntry(entry) {
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizeCreatedEntry(entry, key) {
|
||||
return {
|
||||
id: entry.id,
|
||||
displayKey: `${key.slice(0, 9)}…${key.slice(-4)}`,
|
||||
createdAt: entry.createdAt
|
||||
};
|
||||
}
|
||||
|
||||
function createOnlineBackupManager({
|
||||
keyring,
|
||||
loadSettings,
|
||||
@@ -56,10 +64,7 @@ function createOnlineBackupManager({
|
||||
} catch {}
|
||||
throw error;
|
||||
}
|
||||
const entries = await listEntries();
|
||||
const entry = entries.find((current) => current.id === prepared.id);
|
||||
if (!entry) throw new Error(ERRORS.create);
|
||||
return { ok: true, entry };
|
||||
return { ok: true, entry: sanitizeCreatedEntry(prepared, created.key) };
|
||||
}
|
||||
|
||||
async function deleteTransaction(id) {
|
||||
|
||||
Reference in New Issue
Block a user