Merge branch 'develop' of https://github.com/Frappet/bma-ehr-checkin into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-28 11:29:38 +07:00
commit 23afdc4df9
3 changed files with 36 additions and 16 deletions

View file

@ -1,5 +1,5 @@
import Axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios'
import keycloak, { kcLogout } from './keycloak'
import keycloak from './keycloak'
const http = Axios.create({
timeout: 1000000000, // เพิ่มค่า timeout
@ -31,8 +31,6 @@ http.interceptors.response.use(
// eslint-disable-next-line no-prototype-builtins
if (error.hasOwnProperty('response')) {
if (error.response.status === 401 || error.response.status === 403) {
kcLogout()
// Store.commit("SET_ERROR_MESSAGE", error.response.data.message);
// Store.commit("REMOVE_ACCESS_TOKEN")
}

View file

@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import CustomComponent from '@/components/CustomDialog.vue'
import { Loading, QSpinnerCube } from 'quasar'
import { kcLogout } from '@/plugins/keycloak'
export const useCounterMixin = defineStore('mixin', () => {
function date2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
@ -143,6 +144,12 @@ export const useCounterMixin = defineStore('mixin', () => {
color: 'red',
onlycancel: true,
},
}).onCancel(async () => {
showLoader()
await kcLogout()
setTimeout(() => {
hideLoader()
}, 1000)
})
} else {
const message = e.response.data.result ?? e.response.data.message
@ -169,6 +176,12 @@ export const useCounterMixin = defineStore('mixin', () => {
color: 'red',
onlycancel: true,
},
}).onCancel(async () => {
showLoader()
await kcLogout()
setTimeout(() => {
hideLoader()
}, 1000)
})
} else {
//invalid_token
@ -181,6 +194,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) {

View file

@ -45,20 +45,23 @@ async function fetchNotifications(index: number, type: string) {
if (type === 'DEL') {
notiList.value = []
}
response.map((e: Noti) => {
list.push({
id: e.id,
sender:
e.createdFullName == '' || e.createdFullName == null
? 'เจ้าหน้าที่'[0]
: e.createdFullName[0],
body: e.body ?? '',
timereceive: e.receiveDate,
isOpen: e.isOpen,
if (response.length === 0) {
response.map((e: Noti) => {
list.push({
id: e.id,
sender:
e.createdFullName == '' || e.createdFullName == null
? 'เจ้าหน้าที่'[0]
: e.createdFullName[0],
body: e.body ?? '',
timereceive: e.receiveDate,
isOpen: e.isOpen,
})
})
})
notiList.value.push(...list)
statusLoad.value = totalNotiList.value === 0 ? true : false
notiList.value.push(...list)
statusLoad.value = totalNotiList.value === 0 ? true : false
}
})
// .catch((err) => {
// messageError($q, err)