Sidebar is closed when links are clicked on mobile
All checks were successful
Production Build and Deploy / Build (push) Successful in 1m6s
Production Build and Deploy / Deploy (push) Successful in 22s

This commit is contained in:
Liviu Burcusel 2026-01-20 12:42:09 +01:00
parent 84252b76bb
commit 3d1627a384
Signed by: liviu
GPG key ID: 6CDB37A4AD2C610C
5 changed files with 71 additions and 14 deletions

View file

@ -16,7 +16,7 @@ import { BadgeCheck, Bell, ChevronsUpDown, CreditCard, LogIn, LogOut } from "luc
import type { User } from "better-auth";
const { isMobile } = useSidebar();
const { isMobile, setOpenMobile } = useSidebar();
const props = defineProps<{ user?: User | null | undefined }>();
@ -28,12 +28,9 @@ const userInititials = computed(() => {
.join("");
});
const handleLogout = () => {
navigateTo("/auth/logout");
};
const handleLogin = () => {
navigateTo("/auth/login");
const handleAuthNavigation = (action: string) => {
setOpenMobile(false);
navigateTo(`/auth/${action}`);
};
</script>
@ -93,7 +90,7 @@ const handleLogin = () => {
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem @click="handleLogout">
<DropdownMenuItem @click="handleAuthNavigation('logout')">
<LogOut />
Log out
</DropdownMenuItem>
@ -136,7 +133,7 @@ const handleLogin = () => {
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem @click="handleLogin">
<DropdownMenuItem @click="handleAuthNavigation('login')">
<LogIn />
Log in
</DropdownMenuItem>