fix url favorites

This commit is contained in:
hamid zarghami
2025-12-23 11:19:50 +03:30
parent 4a2fdc4e6e
commit bdd777dd5b
+7 -3
View File
@@ -14,6 +14,7 @@ import { useCart } from '@/app/[name]/(Dialogs)/cart/hook/useCart';
import { Building } from 'iconsax-react';
import clsx from 'clsx';
import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileData';
import { toast } from '../Toast';
type BottomNavBarProps = {
onPagerClick?: () => void;
@@ -42,10 +43,13 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
}, 0);
}, [items]);
const handleFavoritesClick = () => {
const handleFavoritesClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
e.preventDefault();
if (isSuccess) {
router.push('/favorites');
router.push(`/${name}/favorite`);
} else {
e.stopPropagation();
toast('ابتدا لاگین کنید', 'error');
router.push(`/${name}/auth`);
}
}
@@ -122,7 +126,7 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
{t('about')}
</span>
</Link>
<BottomNavLink href="#" onClick={handleFavoritesClick} icon={<HeartIcon width={20} height={20} />} value={t('Favorites')} />
<BottomNavLink href={`/${name}/favorite`} onClick={handleFavoritesClick} icon={<HeartIcon width={20} height={20} />} value={t('Favorites')} />
</nav>
</foreignObject>