Remove notifications from frontend-core
This commit is contained in:
parent
349b22ba25
commit
1a7e845c56
|
@ -56,11 +56,15 @@
|
|||
const exportApp = async () => {
|
||||
const id = published ? app.prodId : app.devId
|
||||
const url = `/api/backups/export?appId=${id}`
|
||||
|
||||
try {
|
||||
await downloadFile(url, {
|
||||
const downloaded = await downloadFile(url, {
|
||||
excludeRows: !includeInternalTablesRows,
|
||||
encryptPassword: password,
|
||||
})
|
||||
if (!downloaded) {
|
||||
notifications.error("Error exporting the app.")
|
||||
}
|
||||
} catch (error) {
|
||||
notifications.error(error.message || "Error downloading the exported app")
|
||||
}
|
||||
|
|
|
@ -44,24 +44,25 @@ export async function downloadFile(url, body) {
|
|||
body: JSON.stringify(body),
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
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)
|
||||
} else {
|
||||
notifications.error("Error exporting the app.")
|
||||
if (!response.ok) {
|
||||
return false
|
||||
}
|
||||
|
||||
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