diff --git a/src/components/feed/Feed/FeedProfile.tsx b/src/components/feed/Feed/FeedProfile.tsx index 9a4718e9..91c248ff 100644 --- a/src/components/feed/Feed/FeedProfile.tsx +++ b/src/components/feed/Feed/FeedProfile.tsx @@ -3,6 +3,7 @@ import Image, { ImageProps } from 'next/image'; import { useRouter } from 'next/navigation'; +import { usePatchFollow } from '@hooks/api/usePatchFollow'; import DefaultProfileImage from 'public/assets/image/default_profile.png'; interface FeedProfileProps extends Omit { @@ -22,17 +23,14 @@ export default function FeedProfile({ ...props }: FeedProfileProps) { const { push } = useRouter(); + const { mutate: patchFollow } = usePatchFollow(); const handleClickProfile = () => { push(`/profile/${userId}`); }; const handleClickFollowButton = () => { - if (isFollowed) { - console.log('팔로우'); - } else { - console.log('팔로우 취소'); - } + patchFollow(userId); }; return ( diff --git a/src/hooks/api/usePatchFollow.ts b/src/hooks/api/usePatchFollow.ts index b55bb460..6354c8a6 100644 --- a/src/hooks/api/usePatchFollow.ts +++ b/src/hooks/api/usePatchFollow.ts @@ -26,6 +26,10 @@ export const usePatchFollow = (): UseMutationResult< queryKey: ['get-following-list'], refetchType: 'all', }); + queryClient.invalidateQueries({ + queryKey: ['get-feed-list', {}], + refetchType: 'all', + }); if (userId !== undefined) { queryClient.invalidateQueries({ queryKey: ['get-userProfile', userId],