updated sso

This commit is contained in:
Warunee Tamkoo 2024-07-16 21:27:39 +07:00
parent 06b0e1dcbd
commit 6538140333
6 changed files with 111 additions and 94 deletions

View file

@ -11,13 +11,7 @@ import { useCounterMixin } from '@/stores/mixin'
import type { Noti } from '@/interface/response/Main'
const mixin = useCounterMixin()
const {
date2Thai,
hideLoader,
messageError,
dialogRemove,
success,
} = mixin
const { date2Thai, hideLoader, messageError, dialogRemove, success } = mixin
const router = useRouter()
const $q = useQuasar()
@ -27,14 +21,12 @@ const totalNotiList = ref<number>(0)
const totalNoti = ref<number>(0)
/*** ฟังก์ชั่นดึงข้อมูลจำนวนการแจ้งเตือน */
async function fetchTotolNotificate() {
await http
.get(config.API.msgNotificateTotal)
.then((res) => {
totalNoti.value = res.data.result
})
// .catch((err) => {
// messageError($q, err)
// })
await http.get(config.API.msgNotificateTotal).then((res) => {
totalNoti.value = res.data.result
})
// .catch((err) => {
// messageError($q, err)
// })
}
const statusLoad = ref<boolean>(false)
@ -68,9 +60,9 @@ async function fetchNotifications(index: number, type: string) {
notiList.value.push(...list)
statusLoad.value = totalNotiList.value === 0 ? true : false
})
// .catch((err) => {
// messageError($q, err)
// })
// .catch((err) => {
// messageError($q, err)
// })
}
/**
@ -104,11 +96,19 @@ function onClickLogout() {
cancel: 'ยกเลิก',
ok: 'ยืนยัน',
persistent: true,
}).onOk(() => {
keycloak.logout()
}).onOk(async () => {
// keycloak.logout()
await deleteCookie('BMAHRIS_KEYCLOAK_IDENTITY')
await deleteCookie('BMAHRIS_KEYCLOAK_REFRESH')
// window.location.href = 'https://bma-sso.frappet.synology.me'
window.location.href = 'http://localhost:3020'
})
}
function deleteCookie(name) {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`
}
const thaiOptions: Intl.DateTimeFormatOptions = {
hour: '2-digit',
minute: '2-digit',
@ -117,8 +117,8 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
const page = ref<number>(0)
/**
* โหลดรายการแจงเตอนเพมเม scroll
* @param index
* @param done
* @param index
* @param done
*/
function onLoad(index: any, done: any) {
if (