From a6e4a9465eed1285d35f5c7792ab2389b3118321 Mon Sep 17 00:00:00 2001 From: prgmr99 Date: Sat, 30 Nov 2024 21:02:35 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20#297=20=EB=B6=81=EB=A7=88=ED=81=AC=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=ED=82=A4=20=EC=A0=84=EB=8B=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/meeteam/card/RecruitCard.tsx | 23 ++++--------------- src/pages/recruit/recruitPage/RecruitPage.tsx | 5 ++-- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/components/meeteam/card/RecruitCard.tsx b/src/components/meeteam/card/RecruitCard.tsx index 41cd2085..b582e0c1 100644 --- a/src/components/meeteam/card/RecruitCard.tsx +++ b/src/components/meeteam/card/RecruitCard.tsx @@ -1,21 +1,14 @@ -import React, { useEffect, useState } from 'react'; +import React from 'react'; import S from './Card.styled'; import { useLocation, useNavigate } from 'react-router-dom'; import { FilledBookmark, UnfilledBookmark } from '../../../assets'; import { ProfileImage } from '../..'; -import { Post, StringElementProps } from '../../../types'; +import { Post } from '../../../types'; import { useBookmark, useLogin } from '../../../hooks'; import { useDelBookmark } from '../../../hooks/useBookMark'; import { useSetRecoilState } from 'recoil'; import { needLoginModalState } from '../../../atom'; -const PATH_OBJ: StringElementProps = { - '/': 'recruit_board', - '/management/bookmark': 'managementBookmark', - '/management/applied': 'managementApplied', - '/management/my-post': 'managementMyPost', -}; - const RecruitCard = ({ id, title, @@ -30,13 +23,12 @@ const RecruitCard = ({ }: Post) => { const location = useLocation(); const navigate = useNavigate(); - const [path, setPath] = useState(''); const { isLogin } = useLogin(); const { mutate: bookmarked } = useBookmark({ - queryKey: path, + queryKey: location.pathname, }); const { mutate: unBookmarked } = useDelBookmark({ - queryKey: path, + queryKey: location.pathname, }); const setNeedLoginModal = useSetRecoilState(needLoginModalState); const extractDeadline = new Date(deadline); @@ -65,13 +57,6 @@ const RecruitCard = ({ } }; - useEffect(() => { - const currentPath = PATH_OBJ[location.pathname]; - if (currentPath) { - setPath(currentPath); - } - }, [location.pathname]); - return (
diff --git a/src/pages/recruit/recruitPage/RecruitPage.tsx b/src/pages/recruit/recruitPage/RecruitPage.tsx index 0cc34ded..41a227f7 100644 --- a/src/pages/recruit/recruitPage/RecruitPage.tsx +++ b/src/pages/recruit/recruitPage/RecruitPage.tsx @@ -73,12 +73,13 @@ const RecruitPage = () => { const [page, setPage] = useRecoilState(pageState); const [filterState, setFilterState] = useRecoilState(recruitFilterState); const [filterStateAuth, setFilterStateAuth] = useRecoilState(recruitFilterStateAuth); - const setDetailedFilterState = useSetRecoilState(detailedFilterState); - const setPreviousLocationState = useSetRecoilState(previousLocationState); const [needLoginModal, setNeedLoginModal] = useRecoilState(needLoginModalState); const [signupModalOpen, setSignupModalOpen] = useRecoilState(signupModalState); const [searchParams, setSearchParams] = useSearchParams(); + const setDetailedFilterState = useSetRecoilState(detailedFilterState); + const setPreviousLocationState = useSetRecoilState(previousLocationState); + const { data: posts } = useQuery({ queryKey: [ location.pathname,