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,