updated authen with keycloak client

This commit is contained in:
Warunee Tamkoo 2024-07-23 14:46:40 +07:00
parent 93cf472aae
commit 9ec6a7696a
8 changed files with 378 additions and 32 deletions

View file

@ -128,7 +128,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) {
@ -159,17 +159,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,