fix(backups): подтверждать операции в текущем контексте

This commit is contained in:
Denozordec committed 2026-10-01 16:11:26 +07:00
1 parent 714af7e872
commit 4c5604bf87
9 files changed
+174 -49

No files matched your search

+7
View File
@@ -77,3 +77,10 @@ export async function testBackupStorage(baseUrl: string, options?: RequestInit)
export async function syncBackupsFromStorage(baseUrl: string, options?: RequestInit) {
return syncBackupsResponseSchema.parse(await backupJson(baseUrl, "/api/backups/storage/sync", { ...options, method: "POST" }))
}
export async function downloadBackup(baseUrl: string, id: string, options?: RequestInit) {
const response = await requestBlob(baseUrl, "/api/backups/" + encodeURIComponent(id) + "/download", backupOptions({ ...options, method: "GET" }))
const type = response.headers.get("Content-Type")?.split(";")[0].trim().toLowerCase()
if (type !== "text/plain" && type !== "application/octet-stream") throw new Error("Файл резервной копии не подтверждён API")
return response.blob()
}