logout
This commit is contained in:
parent
274f903d04
commit
95b3dc7238
2 changed files with 52 additions and 0 deletions
|
|
@ -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<string>('')
|
||||
/** Hook*/
|
||||
onMounted(async () => {
|
||||
await fetchCheckTime()
|
||||
await fetchNotifications()
|
||||
if (keycloak.tokenParsed != null) {
|
||||
fullName.value = keycloak.tokenParsed.name
|
||||
}
|
||||
|
||||
updateClock()
|
||||
})
|
||||
|
|
@ -385,6 +403,39 @@ onMounted(async () => {
|
|||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
round
|
||||
dense
|
||||
flat
|
||||
icon="account_circle"
|
||||
style="font-size: 16px"
|
||||
>
|
||||
<q-menu>
|
||||
<div class="q-pa-md" style="max-width: 500px">
|
||||
<q-list>
|
||||
<q-item>
|
||||
<q-item-section avatar>
|
||||
<q-icon color="primary" name="account_circle" />
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>{{ fullName }}</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item class="text-center">
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="ออกจากระบบ"
|
||||
push
|
||||
size="sm"
|
||||
@click="onClickLogout"
|
||||
/></q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</div> </q-menu
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 q-pa-md text-grey-9">
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@ async function onClickConfirm() {
|
|||
dialogTime.value = false
|
||||
}
|
||||
|
||||
/** function logout*/
|
||||
function onClickLogout() {
|
||||
$q.dialog({
|
||||
title: 'ยืนยันการออกจากระบบ',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue