fixing response blob

This commit is contained in:
Warunee Tamkoo 2024-06-14 11:06:31 +07:00
parent a27091a81a
commit 74f1540203
25 changed files with 138 additions and 119 deletions

View file

@ -129,8 +129,8 @@ const downloadCover = async (type: string) => {
.then(async (res) => {
downloadFile(res, `คำสั่ง ${orderName.value}.${type}`);
})
.catch((e) => {
messageError($q, e);
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
@ -161,8 +161,8 @@ const downloadAttachment = async (type: string) => {
.then(async (res) => {
downloadFile(res, `เอกสารแนบท้าย ${orderName.value}.${type}`);
})
.catch((e) => {
messageError($q, e);
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
@ -207,14 +207,16 @@ const fetchReportCover = async (type: string, orderId: string) => {
viewPDF(orderCoverPdf.value);
}
})
.catch((err) => {
messageError($q, err);
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {});
}
})
.catch((e) => {
messageError($q, e);
.catch(async (e) => {
!genReportStatus.value
? messageError($q, JSON.parse(await e.response.data.text()))
: messageError($q, e);
});
};
//
@ -228,8 +230,8 @@ const fetchReportAttachment = async (type: string, orderId: string) => {
const objectUrl = URL.createObjectURL(blob);
orderAttachmentPdf.value = objectUrl;
})
.catch((e) => {
messageError($q, e);
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
});
};