I'm having an issue with axios where I am trying to download both a PDF and an image file. The image file downloads successfully and opens without any problems, but when I attempt to open the PDF file, it doesn't work as expected.
downloadItem({ url, name }) {
axios
.get(url, { responseType: 'blob' })
.then((response) => {
const blob = new Blob([response.data], { type: response.data.type });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = name;
link.click();
URL.revokeObjectURL(link.href);
})
.catch(console.error);
},
Can anyone provide some assistance on this matter? Apologies for any language errors in my writing.