Skip to content

Commit 28925e1

Browse files
tnyleataylorotwell
andauthored
Adding prefetch to settings and adding logout flush (#116)
* Adding prefetch to settings and adding logout flush * Update UserMenuContent.vue --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent a994387 commit 28925e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

resources/js/components/UserMenuContent.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
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+
const handleLogout = () => {
13+
router.flushAll();
14+
};
15+
1216
defineProps<Props>();
1317
</script>
1418

@@ -21,15 +25,15 @@ defineProps<Props>();
2125
<DropdownMenuSeparator />
2226
<DropdownMenuGroup>
2327
<DropdownMenuItem :as-child="true">
24-
<Link class="block w-full" :href="route('profile.edit')" as="button">
28+
<Link class="block w-full" :href="route('profile.edit')" prefetch as="button">
2529
<Settings class="mr-2 h-4 w-4" />
2630
Settings
2731
</Link>
2832
</DropdownMenuItem>
2933
</DropdownMenuGroup>
3034
<DropdownMenuSeparator />
3135
<DropdownMenuItem :as-child="true">
32-
<Link class="block w-full" method="post" :href="route('logout')" as="button">
36+
<Link class="block w-full" method="post" :href="route('logout')" @click="handleLogout" as="button">
3337
<LogOut class="mr-2 h-4 w-4" />
3438
Log out
3539
</Link>

0 commit comments

Comments
 (0)