refactor: expose online backup deletion outcome

This commit is contained in:
Sucukdeluxe
2026-08-22 10:29:31 +02:00
parent b55f99de24
commit 84032e0e68
2 changed files with 38 additions and 4 deletions
+3 -3
View File
@@ -235,9 +235,9 @@ async function deleteOnlineBackup(key, baseUrl = ONLINE_BACKUP_API_URL, options)
headers: { 'content-type': 'application/json', accept: 'application/json' },
body: JSON.stringify({ id: parsed.id, deleteSecret })
}, options);
if (response.status !== 204) {
throw new Error(response.status === 404 ? 'Online-Sicherung wurde nicht gefunden' : 'Online-Sicherung konnte nicht gelöscht werden');
}
if (response.status === 204) return { deleted: true, notFound: false };
if (response.status === 404) return { deleted: false, notFound: true };
throw new Error('Online-Sicherung konnte nicht gelöscht werden');
}
module.exports = {