test update2

This commit is contained in:
ivan-sim
2023-12-26 16:41:45 +07:00
parent b5c8d8c3b6
commit 841b319aeb
4 changed files with 67 additions and 11 deletions

View File

@@ -51,23 +51,16 @@ function handleChangeTab(event: React.SyntheticEvent, newValue: string) {
const [data, setData] = useState([]);
// Download LOG
async function handleDownloadLog(claimRequest:any) {
async function handleDownloadLog(request_log_id:any) {
return axios
.get(`claim-requests/${claimRequest}/log`, {
.get(`download-log/${request_log_id}`, {
responseType: 'blob',
})
.then((response) => {
window.open(URL.createObjectURL(response.data));
// setLoadingLog(false);
window.open(URL.createObjectURL(response.data), '_blank');
})
// .then((blobFile) => {
// new File([blobFile], 'asdads.pdf', { type: blobFile.type })
// setLoadingLog(false);
// })
.catch((response) => {
console.log(response);
enqueueSnackbar(response.message, { variant: 'error' });
// setLoadingLog(false);
});
}
@@ -358,7 +351,7 @@ function handleChangeTab(event: React.SyntheticEvent, newValue: string) {
View
</MenuItem>
{/* {obj.status === 'approved' ? ( */}
<MenuItem onClick={() => handleDownloadLog(38)}>
<MenuItem onClick={() => handleDownloadLog(obj.id)}>
<Iconify icon="eva:download-fill" />
Download LOG
</MenuItem>