diff --git a/src/components/common/Post.tsx b/src/components/common/Post.tsx index 6d124f5..052ec47 100644 --- a/src/components/common/Post.tsx +++ b/src/components/common/Post.tsx @@ -1,4 +1,4 @@ -import { useNavigate, useLocation } from 'react-router-dom'; +import { useLocation, Link } from 'react-router-dom'; import formatWorkTime from '@/utils/formatWorkTime'; import ClockRed from '@/assets/icons/clock-red.svg'; import ClockGray from '@/assets/icons/clock-gray.svg'; @@ -37,7 +37,6 @@ export default function Post({ data }: { data: NoticeShopItem }) { item: { id: shopId, name, address1, imageUrl, originalHourlyPay }, }, } = data; - const navigate = useNavigate(); const location = useLocation(); const { addRecentlyViewed } = useRecentlyViewed(); const status = getStatus(startsAt, closed); @@ -84,20 +83,15 @@ export default function Post({ data }: { data: NoticeShopItem }) { } } - const handleClick = () => { - addRecentlyViewed(data); + const isOwnerPage = location.pathname.startsWith('/owner'); + const linkPath = isOwnerPage + ? `/owner/post/${shopId}/${noticeId}` + : `/${shopId}/${noticeId}`; - const isOwnerPage = location.pathname.startsWith('/owner'); - - const path = isOwnerPage - ? `/owner/post/${shopId}/${noticeId}` - : `/${shopId}/${noticeId}`; - - navigate(path); - }; return ( - + ); }