updated kpi & check token

This commit is contained in:
Warunee Tamkoo 2024-08-15 14:30:52 +07:00
parent 4d8acb49a3
commit c7d672aeda
8 changed files with 110 additions and 35 deletions

View file

@ -3,6 +3,7 @@ import "moment/dist/locale/th";
import moment from "moment";
import CustomComponent from "@/components/CustomDialog.vue";
import { Loading, QSpinnerCube } from "quasar";
import { kcLogout } from "@/plugins/keycloak";
moment.locale("th");
export const useCounterMixin = defineStore("mixin", () => {
@ -358,8 +359,6 @@ export const useCounterMixin = defineStore("mixin", () => {
}
const messageError = (q: any, e: any = "", text: string = "") => {
console.log(e);
if (e == "" && text != "") {
q.dialog({
component: CustomComponent,
@ -385,6 +384,12 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red",
onlycancel: true,
},
}).onCancel(async () => {
showLoader();
await kcLogout();
setTimeout(() => {
hideLoader();
}, 1000);
});
} else if (e.response.data.result) {
q.dialog({
@ -421,6 +426,12 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red",
onlycancel: true,
},
}).onCancel(async () => {
showLoader();
await kcLogout();
setTimeout(() => {
hideLoader();
}, 1000);
});
} else {
//invalid_token
@ -433,6 +444,12 @@ export const useCounterMixin = defineStore("mixin", () => {
color: "red",
onlycancel: true,
},
}).onCancel(async () => {
showLoader();
await kcLogout();
setTimeout(() => {
hideLoader();
}, 1000);
});
}
} else {