add type generate report

This commit is contained in:
Warunee Tamkoo 2023-12-20 16:30:38 +07:00
parent 624f9cbd47
commit a34a6f96c2

View file

@ -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) => {