From 7eff0285e78a90d84ca572f9393021ba0ea84ed2 Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Thu, 25 Apr 2024 19:19:43 +0800 Subject: [PATCH] Invoice --- src/components/CreateInvoice/CreateInvoice.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/CreateInvoice/CreateInvoice.tsx b/src/components/CreateInvoice/CreateInvoice.tsx index e85d249..a616f2f 100644 --- a/src/components/CreateInvoice/CreateInvoice.tsx +++ b/src/components/CreateInvoice/CreateInvoice.tsx @@ -130,8 +130,8 @@ const CreateInvoice: React.FC = ({ // Check if the request was successful if (response.ok) { // 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 ? contentDisposition.split('filename=')[1] : 'invoice.pdf'; @@ -145,7 +145,7 @@ const CreateInvoice: React.FC = ({ // Create a link element to trigger the file download const link = document.createElement('a'); link.href = url; - link.download = fileName; + link.download = fileName.replace(/"/g, ''); link.click(); // Clean up the temporary URL