Wire tenant archive export in frontend
This commit is contained in:
@@ -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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user