|
|
@@ -1,5 +1,24 @@
|
|
1
|
1
|
<script setup>
|
|
|
2
|
+import { Inertia } from '@inertiajs/inertia'
|
|
2
|
3
|
import { Link } from '@inertiajs/inertia-vue3'
|
|
|
4
|
+import { useConfirm } from 'primevue/useconfirm'
|
|
|
5
|
+
|
|
|
6
|
+const logoutConfirm = useConfirm()
|
|
|
7
|
+
|
|
|
8
|
+const logout = () => {
|
|
|
9
|
+ logoutConfirm.require({
|
|
|
10
|
+ message: 'Ingin keluar dari aplikasi',
|
|
|
11
|
+ header: 'Keluar',
|
|
|
12
|
+ acceptLabel: 'Iya',
|
|
|
13
|
+ rejectLabel: 'Tidak',
|
|
|
14
|
+ accept: () => {
|
|
|
15
|
+ Inertia.post(route('logout'))
|
|
|
16
|
+ },
|
|
|
17
|
+ reject: () => {
|
|
|
18
|
+ logoutConfirm.close()
|
|
|
19
|
+ },
|
|
|
20
|
+ })
|
|
|
21
|
+}
|
|
3
|
22
|
</script>
|
|
4
|
23
|
|
|
5
|
24
|
<template>
|
|
|
@@ -48,19 +67,17 @@ import { Link } from '@inertiajs/inertia-vue3'
|
|
48
|
67
|
</Link>
|
|
49
|
68
|
</li>
|
|
50
|
69
|
<li>
|
|
51
|
|
- <Link
|
|
52
|
|
- :href="route('logout')"
|
|
53
|
|
- as="button"
|
|
54
|
|
- method="post"
|
|
|
70
|
+ <button
|
|
55
|
71
|
class="p-link layout-topbar-button"
|
|
56
|
72
|
v-tooltip.bottom="{
|
|
57
|
73
|
value: 'Keluar',
|
|
58
|
74
|
class: 'layout-topbar-menu-tooltip',
|
|
59
|
75
|
}"
|
|
|
76
|
+ @click="logout"
|
|
60
|
77
|
>
|
|
61
|
78
|
<i class="pi pi-sign-out"></i>
|
|
62
|
79
|
<span>Keluar</span>
|
|
63
|
|
- </Link>
|
|
|
80
|
+ </button>
|
|
64
|
81
|
</li>
|
|
65
|
82
|
</ul>
|
|
66
|
83
|
</div>
|