Download complementary invoices insted of opening them in a new tab in browser

main
Felix Morales 4 months ago
parent 0ebe4efdbb
commit 27a1e46ee8
  1. 17
      src/Components/Corresponsales/CuentasComplementarias/CuentasComplementarias.tsx

@ -298,7 +298,13 @@ export const CuentasComplementarias: FC<IProps> = (props) => {
MFileManagerDataService.getFileContentById(id, proceso)
.then((response: any) => {
if (response.status === 200) {
if (archivo.toLowerCase().endsWith('.pdf')) {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', archivo)
document.body.appendChild(link)
link.click()
/* if (archivo.toLowerCase().endsWith('.pdf')) {
console.log(response.data)
const blob = new Blob([response.data], { type: 'application/pdf' })
const url = window.URL.createObjectURL(blob)
@ -308,7 +314,14 @@ export const CuentasComplementarias: FC<IProps> = (props) => {
const blob = new Blob([response.data], { type: 'application/xml' })
const url = window.URL.createObjectURL(blob)
window.open(url)
}
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', archivo)
document.body.appendChild(link)
link.click()
} */
} else {
setHeader('Error')
setMsg('No existe ningun archivo asignado')

Loading…
Cancel
Save