fixing check token auth
This commit is contained in:
parent
e1acb72512
commit
f4db48d0bf
2 changed files with 21 additions and 5 deletions
|
|
@ -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");
|
||||
|
||||
|
|
@ -346,7 +347,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
}
|
||||
|
||||
const messageError = (q: any, e: any = "", msg: string = "") => {
|
||||
// q.dialog.hide();
|
||||
if (e.response !== undefined) {
|
||||
if (e.response.data.status !== undefined) {
|
||||
if (e.response.data.status == 401) {
|
||||
|
|
@ -360,6 +360,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
color: "red",
|
||||
onlycancel: true,
|
||||
},
|
||||
}).onCancel(async () => {
|
||||
showLoader();
|
||||
await kcLogout();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
} else if (e.response.data.status == 400 && e.response.data.title) {
|
||||
//validation errors
|
||||
|
|
@ -398,6 +404,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
color: "red",
|
||||
onlycancel: true,
|
||||
},
|
||||
}).onCancel(async () => {
|
||||
showLoader();
|
||||
await kcLogout();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
} else {
|
||||
//invalid_token
|
||||
|
|
@ -410,6 +422,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
color: "red",
|
||||
onlycancel: true,
|
||||
},
|
||||
}).onCancel(async () => {
|
||||
showLoader();
|
||||
await kcLogout();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
} else if (e.response.data.successful === false) {
|
||||
|
|
@ -437,8 +455,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
console.error("err===>", e); // ***
|
||||
|
||||
if (e.message && e.message !== "R is not a function") {
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue