diff --git a/resources/js/Layouts/AuthenticatedLayout.vue b/resources/js/Layouts/AuthenticatedLayout.vue index 65bdef89..7efb8d7d 100644 --- a/resources/js/Layouts/AuthenticatedLayout.vue +++ b/resources/js/Layouts/AuthenticatedLayout.vue @@ -16,11 +16,6 @@ const currentRoute = computed(() => { return route().current(); }); -const logoutForm = useForm({}); -function logout() { - logoutForm.post(route('logout')); -} - // Main menu const mainMenuItems = computed(() => [ { @@ -32,6 +27,7 @@ const mainMenuItems = computed(() => [ // User menu (desktop) const userMenu = useTemplateRef('user-menu'); +const logoutForm = useForm({}); const userMenuItems = [ { label: 'Profile', @@ -42,7 +38,7 @@ const userMenuItems = [ label: 'Log Out', icon: 'pi pi-fw pi-sign-out', command: () => { - logout(); + logoutForm.post(route('logout')); }, }, ]; @@ -109,19 +105,19 @@ watchEffect(() => {