Update other places where download is used
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
parent
05851f6b19
commit
0ae378dbec
|
@ -92,13 +92,20 @@
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function downloadWithBlob(data, filename) {
|
||||||
|
download(new Blob([data], { type: "text/plain" }), filename)
|
||||||
|
}
|
||||||
|
|
||||||
async function exportView() {
|
async function exportView() {
|
||||||
try {
|
try {
|
||||||
const data = await API.exportView({
|
const data = await API.exportView({
|
||||||
viewName: view,
|
viewName: view,
|
||||||
format: exportFormat,
|
format: exportFormat,
|
||||||
})
|
})
|
||||||
download(data, `export.${exportFormat === "csv" ? "csv" : "json"}`)
|
downloadWithBlob(
|
||||||
|
data,
|
||||||
|
`export.${exportFormat === "csv" ? "csv" : "json"}`
|
||||||
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error(`Unable to export ${exportFormat.toUpperCase()} data`)
|
notifications.error(`Unable to export ${exportFormat.toUpperCase()} data`)
|
||||||
}
|
}
|
||||||
|
@ -111,7 +118,7 @@
|
||||||
rows: selectedRows.map(row => row._id),
|
rows: selectedRows.map(row => row._id),
|
||||||
format: exportFormat,
|
format: exportFormat,
|
||||||
})
|
})
|
||||||
download(data, `export.${exportFormat}`)
|
downloadWithBlob(data, `export.${exportFormat}`)
|
||||||
} else if (filters || sorting) {
|
} else if (filters || sorting) {
|
||||||
let response
|
let response
|
||||||
try {
|
try {
|
||||||
|
@ -130,10 +137,7 @@
|
||||||
notifications.error("Export Failed")
|
notifications.error("Export Failed")
|
||||||
}
|
}
|
||||||
if (response) {
|
if (response) {
|
||||||
download(
|
downloadWithBlob(response, `export.${exportFormat}`)
|
||||||
new Blob([response], { type: "text/plain" }),
|
|
||||||
`export.${exportFormat}`
|
|
||||||
)
|
|
||||||
notifications.success("Export Successful")
|
notifications.success("Export Successful")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue