|
|
|
|
|
|
|
|
}, []); |
|
|
}, []); |
|
|
|
|
|
|
|
|
function downloadFile(filePath) { |
|
|
function downloadFile(filePath) { |
|
|
var link = document.createElement('a'); |
|
|
|
|
|
link.href = filePath; |
|
|
|
|
|
link.download = filePath.substr(filePath.lastIndexOf('/') + 1); |
|
|
|
|
|
link.click(); |
|
|
|
|
|
|
|
|
// var link = document.createElement('a'); |
|
|
|
|
|
// link.href = filePath; |
|
|
|
|
|
// link.download = filePath.substr(filePath.lastIndexOf('/') + 1); |
|
|
|
|
|
// link.click(); |
|
|
|
|
|
window.open(filePath.substr(filePath.lastIndexOf('/') + 1), "_blank"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleFileDownload = (url, filename) => { |
|
|
|
|
|
fetch(url).then(response => { |
|
|
|
|
|
return response.blob().then(blob => { |
|
|
|
|
|
//console.log(blob); |
|
|
|
|
|
//console.log(response.body); |
|
|
|
|
|
console.log(blob.raw); |
|
|
|
|
|
//fileDownload(response.headers.get('Content-Type'), blob); |
|
|
|
|
|
//fileDownload(response.url, blob); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
formSuccess && downloadFile(download.downloadFilePath); |
|
|
formSuccess && downloadFile(download.downloadFilePath); |
|
|
}, [formSuccess]); |
|
|
}, [formSuccess]); |