update auth
This commit is contained in:
parent
23afdc4df9
commit
ff3fb68219
12 changed files with 222 additions and 308 deletions
|
|
@ -2,9 +2,9 @@
|
|||
import { ref, onMounted, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useQuasar } from 'quasar'
|
||||
import keycloak, { kcLogout } from '@/plugins/keycloak'
|
||||
import http from '@/plugins/http'
|
||||
import config from '@/app.config'
|
||||
import { logout, tokenParsed } from '@/plugins/auth'
|
||||
|
||||
import type { notiType } from '@/interface/index/Main'
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
|
|
@ -46,22 +46,20 @@ async function fetchNotifications(index: number, type: string) {
|
|||
notiList.value = []
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
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)
|
||||
|
|
@ -100,7 +98,7 @@ function onClickLogout() {
|
|||
ok: 'ยืนยัน',
|
||||
persistent: true,
|
||||
}).onOk(async () => {
|
||||
kcLogout()
|
||||
logout()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +143,9 @@ watch(
|
|||
const fullName = ref<string>('')
|
||||
onMounted(async () => {
|
||||
fetchTotolNotificate()
|
||||
if (keycloak.tokenParsed != null) {
|
||||
fullName.value = keycloak.tokenParsed.name
|
||||
const checkTokenParsed = await tokenParsed()
|
||||
if (checkTokenParsed != null) {
|
||||
fullName.value = checkTokenParsed.name
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue