made it download exe, and made that work (scuffed in GO)

This commit is contained in:
HerpieDerpie@example.com
2024-03-19 22:10:51 +01:00
parent 749a01b8e4
commit c9e10b85b8
11 changed files with 210 additions and 492 deletions

View File

@@ -67,33 +67,30 @@ function exportProject() {
return response.blob();
})
.then(blob => {
// Create a link element
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
// Set the download attribute and trigger a click
link.download = `bot_builds_${getProjectId()}.zip`;
// Adjusted for .exe download; consider adjusting the filename as needed
link.download = `discordBot_${getProjectId()}.exe`;
document.body.appendChild(link); // Append to body to ensure visibility in some browsers
link.click();
// Clean up
document.body.removeChild(link); // Clean up
window.URL.revokeObjectURL(link.href);
Swal.close();
})
.then(() => {
Swal.fire({
title: "Exported!",
text: "Your project has been exported.",
text: "Your project has been exported successfully.",
icon: "success"
});
loadData();
loadData(); // Reload or refresh data if necessary
})
.catch(error => {
console.error('Error:', error);
Swal.fire({
title: "Export Failed",
text: "There was an error exporting your project.",
text: "There was an error exporting your project. Please try again.",
icon: "error"
});
});