From 71b5de56830a943fe2b8bf78bfed8839432606cf Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 13 Jun 2024 16:29:22 +0700 Subject: [PATCH] =?UTF-8?q?fixing=20response=20error=20404=20=E0=B8=AA?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=AA=E0=B8=A3=E0=B8=A3?= =?UTF-8?q?=E0=B8=AB=E0=B8=B2=E0=B8=AA=E0=B8=AD=E0=B8=9A=E0=B9=81=E0=B8=82?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=82=E0=B8=B1=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../03_recruiting/views/01_compete/Detail.vue | 16 +++++++- src/stores/mixin.ts | 41 +++++++++++++------ 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/modules/03_recruiting/views/01_compete/Detail.vue b/src/modules/03_recruiting/views/01_compete/Detail.vue index 4909c3fa7..ac7e6cdf7 100644 --- a/src/modules/03_recruiting/views/01_compete/Detail.vue +++ b/src/modules/03_recruiting/views/01_compete/Detail.vue @@ -408,7 +408,13 @@ const downloadPassExam = async () => { a.click(); }) .catch((e) => { - messageError($q, e); + messageError( + $q, + e, + rows.value.length == 0 + ? "ไม่พบข้อมูลผลการสอบ กรุณาตรวจสอบความถูกต้องอีกครั้ง!" + : "" + ); }) .finally(() => { hideLoader(); @@ -429,7 +435,13 @@ const downloadPassResultExam = async () => { a.click(); }) .catch((e) => { - messageError($q, e); + messageError( + $q, + e, + rows.value.length == 0 + ? "ไม่พบข้อมูลผลการสอบ กรุณาตรวจสอบความถูกต้องอีกครั้ง!" + : "" + ); }) .finally(() => { hideLoader(); diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index babac88e2..49e32d477 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -345,7 +345,7 @@ export const useCounterMixin = defineStore("mixin", () => { } } - const messageError = (q: any, e: any = "") => { + const messageError = (q: any, e: any = "", msg: string = "") => { // q.dialog.hide(); if (e.response !== undefined) { if (e.response.data.status !== undefined) { @@ -411,22 +411,37 @@ export const useCounterMixin = defineStore("mixin", () => { }, }); } else { - console.log("errror===>", e); + console.error(e.response.data); // *** + console.error(e.response.status); // *** - q.dialog({ - component: CustomComponent, - componentProps: { - title: `พบข้อผิดพลาด`, - message: `ข้อมูลผิดพลาดทำให้เกิดการไม่ตอบสนองต่อการเรียกใช้งานดูเว็บไซต์`, - icon: "warning", - color: "red", - onlycancel: true, - }, - }); + if (e.response.status == 404) { + q.dialog({ + component: CustomComponent, + componentProps: { + title: `พบข้อผิดพลาด`, + message: msg, + icon: "warning", + color: "red", + onlycancel: true, + }, + }); + } else { + q.dialog({ + component: CustomComponent, + componentProps: { + title: `พบข้อผิดพลาด`, + message: `ข้อมูลผิดพลาดทำให้เกิดการไม่ตอบสนองต่อการเรียกใช้งานดูเว็บไซต์`, + icon: "warning", + color: "red", + onlycancel: true, + }, + }); + } } } } else { - console.log("errror===>", e); + console.error(e.response.data); // *** + console.error(e.response.status); // *** q.dialog({ component: CustomComponent,