ソースを参照

Invoice

tags/Baseline_30082024_FRONTEND_UAT
MSI\2Fi 1年前
コミット
7eff0285e7
1個のファイルの変更3行の追加3行の削除
  1. +3
    -3
      src/components/CreateInvoice/CreateInvoice.tsx

+ 3
- 3
src/components/CreateInvoice/CreateInvoice.tsx ファイルの表示

@@ -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


読み込み中…
キャンセル
保存