diff --git a/src/plugins/genreport.ts b/src/plugins/genreport.ts index 534694828..09851d2a7 100644 --- a/src/plugins/genreport.ts +++ b/src/plugins/genreport.ts @@ -10,15 +10,21 @@ const { showLoader, hideLoader, messageError } = mixin; const apiGenReport = "https://report-server.frappet.synology.me/api/v1/report-template/docx"; -async function genReport(data: any, fileName: string) { +async function genReport(data: any, fileName: string, type: string = "docx") { showLoader(); await axios .post(apiGenReport, data, { - headers: { - accept: - "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "content-Type": "application/json", - }, + headers: + type == "docx" + ? { + accept: + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "content-Type": "application/json", + } + : { + accept: "application/pdf", + "content-Type": "application/json", + }, responseType: "arraybuffer", }) .then((res) => {