Skip to content

Commit 9b11cc8

Browse files
committed
Adding prefetch to settings and adding logout flush
1 parent a994387 commit 9b11cc8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

resources/js/components/UserMenuContent.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
import UserInfo from '@/components/UserInfo.vue';
33
import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from '@/components/ui/dropdown-menu';
44
import type { User } from '@/types';
5-
import { Link } from '@inertiajs/vue3';
5+
import { Link, router } from '@inertiajs/vue3';
66
import { LogOut, Settings } from 'lucide-vue-next';
77
88
interface Props {
99
user: User;
1010
}
1111
12+
// Define the logout handler function
13+
const handleLogout = () => {
14+
router.flushAll();
15+
};
16+
1217
defineProps<Props>();
1318
</script>
1419

@@ -21,15 +26,15 @@ defineProps<Props>();
2126
<DropdownMenuSeparator />
2227
<DropdownMenuGroup>
2328
<DropdownMenuItem :as-child="true">
24-
<Link class="block w-full" :href="route('profile.edit')" as="button">
29+
<Link class="block w-full" :href="route('profile.edit')" prefetch as="button">
2530
<Settings class="mr-2 h-4 w-4" />
2631
Settings
2732
</Link>
2833
</DropdownMenuItem>
2934
</DropdownMenuGroup>
3035
<DropdownMenuSeparator />
3136
<DropdownMenuItem :as-child="true">
32-
<Link class="block w-full" method="post" :href="route('logout')" as="button">
37+
<Link class="block w-full" method="post" :href="route('logout')" @click="handleLogout" as="button">
3338
<LogOut class="mr-2 h-4 w-4" />
3439
Log out
3540
</Link>

0 commit comments

Comments
 (0)