From 702deba0eab0e12d82a09ea6bd344ab0258592c0 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 23 Jul 2024 14:09:04 +0700 Subject: [PATCH] updated mixin error message function --- src/stores/mixin.ts | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 2238acb78..88c1d941f 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -388,17 +388,30 @@ export const useCounterMixin = defineStore("mixin", () => { } } else { if (e.response.status == 401) { - //invalid_token - q.dialog({ - component: CustomComponent, - componentProps: { - title: `พบข้อผิดพลาด`, - message: `ล็อกอินหมดอายุ กรุณาล็อกอินใหม่อีกครั้ง`, - icon: "warning", - color: "red", - onlycancel: true, - }, - }); + if (msg !== "") { + q.dialog({ + component: CustomComponent, + componentProps: { + title: `พบข้อผิดพลาด`, + message: msg, + icon: "warning", + color: "red", + onlycancel: true, + }, + }); + } else { + //invalid_token + q.dialog({ + component: CustomComponent, + componentProps: { + title: `พบข้อผิดพลาด`, + message: `ล็อกอินหมดอายุ กรุณาล็อกอินใหม่อีกครั้ง`, + icon: "warning", + color: "red", + onlycancel: true, + }, + }); + } } else if (e.response.data.successful === false) { q.dialog({ component: CustomComponent,