Update project file download logic to use fetch POST request
This commit is contained in:
@@ -20,19 +20,15 @@ function ProjectManager() {
|
|||||||
const appState = useAppState();
|
const appState = useAppState();
|
||||||
const projects = useProjectsList();
|
const projects = useProjectsList();
|
||||||
|
|
||||||
const downloadProjectFile = () => {
|
const downloadProjectFile = async () => {
|
||||||
if (!data?.projectFile) {
|
if (!data?.projectFile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = URL.createObjectURL(data.projectFile);
|
await fetch('http://127.0.0.1:5174/project-05.tar', {
|
||||||
const link = document.createElement('a');
|
method: 'POST',
|
||||||
link.href = url;
|
body: data.projectFile,
|
||||||
link.download = data.projectFile.name;
|
});
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
link.remove();
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user