From ad8bed057621c69e8d22a0816041a28f6bef7353 Mon Sep 17 00:00:00 2001 From: Geriano Date: Sat, 30 Jul 2022 11:53:11 +0700 Subject: [PATCH] adding prompt before logout --- .../js/Components/DashboardLayout/TopbarDropdown.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/js/Components/DashboardLayout/TopbarDropdown.vue b/resources/js/Components/DashboardLayout/TopbarDropdown.vue index bb09c68..929a48c 100644 --- a/resources/js/Components/DashboardLayout/TopbarDropdown.vue +++ b/resources/js/Components/DashboardLayout/TopbarDropdown.vue @@ -3,11 +3,21 @@ import { getCurrentInstance, ref } from 'vue' import { usePage, Link } from '@inertiajs/inertia-vue3' import { Inertia } from '@inertiajs/inertia' import Icon from '../Icon.vue' +import Swal from 'sweetalert2' const open = ref(false) const { user } = usePage().props.value -const logout = () => Inertia.post(route('logout')) +const logout = async () => { + const response = await Swal.fire({ + title: 'Are you sure?', + icon: 'question', + showCloseButton: true, + showCancelButton: true, + }) + + response.isConfirmed && Inertia.post(route('logout')) +}