From 274f903d0498270f3a62d92b1173440d92b65201 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 12 Dec 2023 09:29:58 +0700 Subject: [PATCH] logouut --- src/views/HomeView.vue | 9 +++++++- src/views/MapView.vue | 51 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index a7b442c..6ebc5e8 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -20,7 +20,14 @@ import MapCheck from '@/components/MapCheckin.vue' import { useCounterMixin } from '@/stores/mixin' const mixin = useCounterMixin() -const { date2Thai, showLoader, hideLoader, messageError, dialogRemove } = mixin +const { + date2Thai, + showLoader, + hideLoader, + messageError, + dialogRemove, + success, +} = mixin const router = useRouter() const $q = useQuasar() diff --git a/src/views/MapView.vue b/src/views/MapView.vue index dcddc72..749f05b 100644 --- a/src/views/MapView.vue +++ b/src/views/MapView.vue @@ -2,6 +2,7 @@ import { ref, reactive, onMounted } from 'vue' import { useRouter } from 'vue-router' import { useQuasar } from 'quasar' +import keycloak from '@/plugins/keycloak' import moment from 'moment' import Camera from 'simple-vue-camera' import http from '@/plugins/http' @@ -287,6 +288,18 @@ async function onClickConfirm() { dialogTime.value = false } +function onClickLogout() { + $q.dialog({ + title: 'ยืนยันการออกจากระบบ', + message: `ต้องการออกจากระบบใช้หรือไม่?`, + cancel: 'ยกเลิก', + ok: 'ยืนยัน', + persistent: true, + }).onOk(() => { + keycloak.logout() + }) +} + // class const getClass = (val: boolean) => { return { @@ -294,10 +307,15 @@ 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() }) @@ -387,6 +405,39 @@ onMounted(async () => { + + +
+ + + + + + + {{ fullName }} + + + + + + + + + +