|
@@ -130,8 +130,8 @@ const CreateInvoice: React.FC = ({ |
|
|
// Check if the request was successful |
|
|
// Check if the request was successful |
|
|
if (response.ok) { |
|
|
if (response.ok) { |
|
|
// Extract the filename from the response headers |
|
|
// Extract the filename from the response headers |
|
|
const contentDisposition = response.headers.get('content-disposition'); |
|
|
|
|
|
console.log(contentDisposition) |
|
|
|
|
|
|
|
|
const contentDisposition = response.headers.get("Content-Disposition"); |
|
|
|
|
|
// response.headers.forEach(e => console.log(e)) |
|
|
const fileName = contentDisposition |
|
|
const fileName = contentDisposition |
|
|
? contentDisposition.split('filename=')[1] |
|
|
? contentDisposition.split('filename=')[1] |
|
|
: 'invoice.pdf'; |
|
|
: 'invoice.pdf'; |
|
@@ -145,7 +145,7 @@ const CreateInvoice: React.FC = ({ |
|
|
// Create a link element to trigger the file download |
|
|
// Create a link element to trigger the file download |
|
|
const link = document.createElement('a'); |
|
|
const link = document.createElement('a'); |
|
|
link.href = url; |
|
|
link.href = url; |
|
|
link.download = fileName; |
|
|
|
|
|
|
|
|
link.download = fileName.replace(/"/g, ''); |
|
|
link.click(); |
|
|
link.click(); |
|
|
|
|
|
|
|
|
// Clean up the temporary URL |
|
|
// Clean up the temporary URL |
|
|