diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 6ebc5e8..e489c83 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -6,6 +6,7 @@ import moment from 'moment' import Camera from 'simple-vue-camera' import http from '@/plugins/http' import config from '@/app.config' +import keycloak from '@/plugins/keycloak' // import Type import type { FormRef } from '@/interface/response/checkin' @@ -285,6 +286,19 @@ async function onClickConfirm() { dialogTime.value = false } +/** function logout*/ +function onClickLogout() { + $q.dialog({ + title: 'ยืนยันการออกจากระบบ', + message: `ต้องการออกจากระบบใช้หรือไม่?`, + cancel: 'ยกเลิก', + ok: 'ยืนยัน', + persistent: true, + }).onOk(() => { + keycloak.logout() + }) +} + // class const getClass = (val: boolean) => { return { @@ -292,10 +306,14 @@ const getClass = (val: boolean) => { 'bg-red-9 text-white col-12 row items-center q-px-md q-py-sm': !val, } } +const fullName = ref('') /** Hook*/ onMounted(async () => { await fetchCheckTime() await fetchNotifications() + if (keycloak.tokenParsed != null) { + fullName.value = keycloak.tokenParsed.name + } updateClock() }) @@ -385,6 +403,39 @@ onMounted(async () => { + + +
+ + + + + + + {{ fullName }} + + + + + + + + + +
diff --git a/src/views/MapView.vue b/src/views/MapView.vue index 749f05b..4cfb15e 100644 --- a/src/views/MapView.vue +++ b/src/views/MapView.vue @@ -288,6 +288,7 @@ async function onClickConfirm() { dialogTime.value = false } +/** function logout*/ function onClickLogout() { $q.dialog({ title: 'ยืนยันการออกจากระบบ',