fix url favorites
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user