From a0f0443a55a0f5fb6d4d543d856285264cf7a682 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 29 May 2026 13:55:05 +0700 Subject: [PATCH] refactor: downloadBlobFile with direct blob download logic --- src/plugins/genreport.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/genreport.ts b/src/plugins/genreport.ts index 19e2856..500dca4 100644 --- a/src/plugins/genreport.ts +++ b/src/plugins/genreport.ts @@ -2,7 +2,6 @@ import axios from "axios"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; -import { downloadBlobFile } from "@/modules/10_registry/utils/downloadFile"; const mixin = useCounterMixin(); const { showLoader, hideLoader } = mixin; @@ -32,11 +31,16 @@ async function genReport(data: any, fileName: string, type: string = "docx") { const url = URL.createObjectURL(blob); const baseName = fileName.trim(); - // const extension = type === "docx" ? "docx" : "pdf"; - await downloadBlobFile({ - downloadUrl: url, - fileName: baseName, - }); + const extension = type === "docx" ? "docx" : "pdf"; + const link = document.createElement("a"); + link.href = url; + link.download = `${baseName}.${extension}`; + document.body.appendChild(link); + link.click(); + setTimeout(() => { + document.body.removeChild(link); + URL.revokeObjectURL(url); + }, 100); } }) .catch((err) => {