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 { Building } from 'iconsax-react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileData';
|
import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileData';
|
||||||
|
import { toast } from '../Toast';
|
||||||
|
|
||||||
type BottomNavBarProps = {
|
type BottomNavBarProps = {
|
||||||
onPagerClick?: () => void;
|
onPagerClick?: () => void;
|
||||||
@@ -42,10 +43,13 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
|
|||||||
}, 0);
|
}, 0);
|
||||||
}, [items]);
|
}, [items]);
|
||||||
|
|
||||||
const handleFavoritesClick = () => {
|
const handleFavoritesClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
router.push('/favorites');
|
router.push(`/${name}/favorite`);
|
||||||
} else {
|
} else {
|
||||||
|
e.stopPropagation();
|
||||||
|
toast('ابتدا لاگین کنید', 'error');
|
||||||
router.push(`/${name}/auth`);
|
router.push(`/${name}/auth`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +126,7 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
|
|||||||
{t('about')}
|
{t('about')}
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</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>
|
</nav>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user