Remove notifications from frontend-core
This commit is contained in:
parent
349b22ba25
commit
1a7e845c56
|
@ -56,11 +56,15 @@
|
||||||
const exportApp = async () => {
|
const exportApp = async () => {
|
||||||
const id = published ? app.prodId : app.devId
|
const id = published ? app.prodId : app.devId
|
||||||
const url = `/api/backups/export?appId=${id}`
|
const url = `/api/backups/export?appId=${id}`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await downloadFile(url, {
|
const downloaded = await downloadFile(url, {
|
||||||
excludeRows: !includeInternalTablesRows,
|
excludeRows: !includeInternalTablesRows,
|
||||||
encryptPassword: password,
|
encryptPassword: password,
|
||||||
})
|
})
|
||||||
|
if (!downloaded) {
|
||||||
|
notifications.error("Error exporting the app.")
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error(error.message || "Error downloading the exported app")
|
notifications.error(error.message || "Error downloading the exported app")
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,24 +44,25 @@ export async function downloadFile(url, body) {
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response.ok) {
|
if (!response.ok) {
|
||||||
const contentDisposition = response.headers.get("Content-Disposition")
|
return false
|
||||||
|
|
||||||
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(
|
|
||||||
contentDisposition
|
|
||||||
)
|
|
||||||
|
|
||||||
const filename = matches[1].replace(/['"]/g, "")
|
|
||||||
|
|
||||||
const url = URL.createObjectURL(await response.blob())
|
|
||||||
|
|
||||||
const link = document.createElement("a")
|
|
||||||
link.href = url
|
|
||||||
link.download = filename
|
|
||||||
link.click()
|
|
||||||
|
|
||||||
URL.revokeObjectURL(url)
|
|
||||||
} else {
|
|
||||||
notifications.error("Error exporting the app.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const contentDisposition = response.headers.get("Content-Disposition")
|
||||||
|
|
||||||
|
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(
|
||||||
|
contentDisposition
|
||||||
|
)
|
||||||
|
|
||||||
|
const filename = matches[1].replace(/['"]/g, "")
|
||||||
|
|
||||||
|
const url = URL.createObjectURL(await response.blob())
|
||||||
|
|
||||||
|
const link = document.createElement("a")
|
||||||
|
link.href = url
|
||||||
|
link.download = filename
|
||||||
|
link.click()
|
||||||
|
|
||||||
|
URL.revokeObjectURL(url)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue