Skip to content

Commit

Permalink
Merge pull request #298 from MeeTeamIdle/fix/#297-북마크-캐싱-제거되지-않는-이슈
Browse files Browse the repository at this point in the history
fix: #297 북마크 쿼리키 전달하는 값 수정
  • Loading branch information
prgmr99 authored Dec 2, 2024
2 parents 8560527 + a6e4a94 commit 2717e66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
23 changes: 4 additions & 19 deletions src/components/meeteam/card/RecruitCard.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -65,13 +57,6 @@ const RecruitCard = ({
}
};

useEffect(() => {
const currentPath = PATH_OBJ[location.pathname];
if (currentPath) {
setPath(currentPath);
}
}, [location.pathname]);

return (
<S.RecruitCard onClick={onClickContent} $isClosed={isClosed}>
<section className='content-tags'>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/recruit/recruitPage/RecruitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ const RecruitPage = () => {
const [page, setPage] = useRecoilState<number>(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,
Expand Down

0 comments on commit 2717e66

Please sign in to comment.