Wire tenant archive export in frontend

This commit is contained in:
2026-07-05 12:31:59 +02:00
parent 0a7b0448ad
commit 3c4a75a858
3 changed files with 108 additions and 24 deletions

View File

@@ -103,8 +103,17 @@ const importTenantExport = async (event: Event) => {
importingTenant.value = true
try {
const exportData = JSON.parse(await file.text())
const result = await admin.importTenant(exportData)
const isZipExport = file.name.endsWith(".zip") || file.name.endsWith(".fedeo-export.zip") || file.type === "application/zip"
let result
if (isZipExport) {
const formData = new FormData()
formData.append("file", file)
result = await admin.importTenant(formData)
} else {
result = await admin.importTenant(JSON.parse(await file.text()))
}
const rowCount = (result.tables || []).reduce((sum, table) => sum + table.rows, 0)
await fetchTenants()
@@ -158,7 +167,7 @@ onMounted(async () => {
<input
ref="importFileInput"
type="file"
accept="application/json,.json"
accept="application/json,application/zip,.json,.zip,.fedeo-export.zip"
class="hidden"
@change="importTenantExport"
>