add cart no token replace auth login

This commit is contained in:
Samandar Turgunboyev
2026-03-04 16:36:22 +05:00
parent f04ae13c39
commit 95d17b274f
6 changed files with 78 additions and 30 deletions

View File

@@ -453,7 +453,14 @@ const Navbar = () => {
<Button
variant={'ghost'}
className="h-10 max-lg:hidden cursor-pointer border border-slate-200"
onClick={() => router.push('/favourite')}
onClick={(e) => {
e.stopPropagation();
if (token) {
router.push('/favourite');
return;
}
router.push('/auth');
}}
aria-label="my favouurite product"
>
<Heart className="size-4 text-foreground" />
@@ -461,7 +468,14 @@ const Navbar = () => {
<Button
variant={'ghost'}
id="cart-icon"
onClick={() => router.push('/cart')}
onClick={(e) => {
e.stopPropagation();
if (token) {
router.push('/cart');
return;
}
router.push('/auth');
}}
className="h-10 relative max-lg:hidden cursor-pointer border border-slate-200"
>
<ShoppingCart className="size-4 text-foreground" />