fix(web): download full database SQL export via browser

This commit is contained in:
t8y2 committed 2026-06-19 09:35:19 +08:00
1 parent 4f5d09aaa8
commit fffdcb9db1
3 files changed
+107 -15

No files matched your search

+11
View File
@@ -1179,6 +1179,11 @@ export async function exportDatabaseSql(request: DatabaseExportRequest, onProgre
onProgress(progress);
if (progress.status === "Done" || progress.status === "Error" || progress.status === "Cancelled") {
es.close();
if (progress.status === "Done") {
// Trigger browser download; filename is decided by the server's
// Content-Disposition header.
downloadDatabaseExportFile(request.exportId);
}
resolve();
}
};
@@ -1189,6 +1194,12 @@ export async function exportDatabaseSql(request: DatabaseExportRequest, onProgre
});
}
function downloadDatabaseExportFile(exportId: string): void {
const a = document.createElement("a");
a.href = `/api/export/database/download/${exportId}`;
a.click();
}
export async function cancelDatabaseExport(exportId: string): Promise<void> {
await post("/api/export/database/cancel", { exportId });
}