diff --git a/resources/js/Layouts/AuthenticatedLayout.vue b/resources/js/Layouts/AuthenticatedLayout.vue index 0e6bd032..0ad400fd 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')); }, }, ]; @@ -111,19 +107,19 @@ if (import.meta.env.SSR === false) {