|
@@ -82,13 +82,17 @@ export const fileDownload = ({fileId, skey, filename, onResponse, onError}) =>{ |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export const reportDownload = ({url, filename, onError}) =>{ |
|
|
|
|
|
|
|
|
export const reportDownload = ({url, onError}) =>{ |
|
|
axios.get( url, |
|
|
axios.get( url, |
|
|
{ |
|
|
{ |
|
|
responseType: 'blob', |
|
|
responseType: 'blob', |
|
|
} |
|
|
} |
|
|
).then( |
|
|
).then( |
|
|
(response)=>{ |
|
|
(response)=>{ |
|
|
|
|
|
const filename = response.headers |
|
|
|
|
|
.get("content-disposition") |
|
|
|
|
|
.split("filename=")[1] |
|
|
|
|
|
.split('"')[1].trim(); |
|
|
const url = URL.createObjectURL(response.data); |
|
|
const url = URL.createObjectURL(response.data); |
|
|
const a = document.createElement('a'); |
|
|
const a = document.createElement('a'); |
|
|
a.href = url; |
|
|
a.href = url; |
|
|