|
|
|
@ -81,7 +81,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
|
|
|
|
|
setAlertDeleteFolder(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleDownload = (id) => { |
|
|
|
|
const handleDownload = (id, file) => { |
|
|
|
|
fetch(DOCUMENT_DOWNLOAD(id), { |
|
|
|
|
headers: new Headers({ |
|
|
|
|
'Content-Type': 'application/json', |
|
|
|
@ -90,11 +90,12 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
|
|
|
|
|
}) |
|
|
|
|
.then(response => { |
|
|
|
|
response.blob().then(blob => { |
|
|
|
|
let url = window.URL.createObjectURL(blob); |
|
|
|
|
const url = window.URL.createObjectURL(new Blob([blob])); |
|
|
|
|
let a = document.createElement('a'); |
|
|
|
|
a.href = url; |
|
|
|
|
a.download = 'Project Documents'; |
|
|
|
|
a.download = file; |
|
|
|
|
a.click(); |
|
|
|
|
a.remove(); |
|
|
|
|
}); |
|
|
|
|
//window.location.href = response.url;
|
|
|
|
|
}); |
|
|
|
@ -156,7 +157,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
|
|
|
|
|
<Button size={"sm"} color='danger' onClick={() => handleDeleteFolder(text.id)}><i className="fa fa-trash"></i></Button> |
|
|
|
|
</Tooltip>}{" "} |
|
|
|
|
{!record.isDir && <Tooltip title="Download Document"> |
|
|
|
|
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id)}><i className="fa fa-download"></i></Button> |
|
|
|
|
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id, text.file)}><i className="fa fa-download"></i></Button> |
|
|
|
|
</Tooltip>}{" "} |
|
|
|
|
{record.isDir && <Tooltip title="New Folder"> |
|
|
|
|
<Button size="sm" color="success" onClick={() => handleNewFolderParent(record.id)}><i className="fa fa-folder"></i></Button> |
|
|
|
@ -337,4 +338,4 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default DialogDocument; |
|
|
|
|
export default DialogDocument; |
|
|
|
|