Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 팔로잉 취소 추가, 팔로잉 / 팔로잉 취소 시 화면 바로 반영 #158

Merged
merged 7 commits into from
Jul 20, 2022

Conversation

chogyejin
Copy link
Member

📌 기능 설명

팔로잉 취소 추가, 팔로잉 / 팔로잉 취소 시 화면 바로 반영

👩‍💻 요구 사항과 구현 내용

기존에는 현재 사용자가 다른 사용자 페이지에 방문했을 때 팔로잉 중인지 아닌지 구분이 없었는데

  1. OtherProfilePage에 진입 시에 useEffect를 통해 해당 다른 사용자의 follower를 순회하며 현재 사용자가 팔로워 목록에 있는지 확인하여 팔로잉 상태(isFollowing)를 구분하고
  2. 팔로잉 중일 때 버튼을 누르면 팔로잉을 취소할 거냐고 묻는 confirm을 추가했습니다. 여기서 확인을 누르면 팔로잉 취소가 됩니다.
  3. 팔로잉 / 팔로잉 취소를 useMutatio을 통해 요청하는데, 요청이 성공하면(useMutation의 옵션으로 전달되는 onSuccess) 해당 페이지의 followerList라는 state의 변화를 통해 화면을 리렌더링 합니다.

구현 결과

스크린샷 2022-07-13 23 23 40

스크린샷 2022-07-13 23 23 43

스크린샷 2022-07-13 23 23 44

@chogyejin chogyejin self-assigned this Jul 13, 2022
@vercel
Copy link

vercel bot commented Jul 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
shallenge ✅ Ready (Inspect) Visit Preview Jul 14, 2022 at 1:34PM (UTC)

<div>팔로워</div>
</div>
<div>
<Text onClick={handleFollowingClick}>{followingCount}</Text>
<Text cursor="pointer" onClick={handleFollowCountClick}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전달인자, 반환값없는 함수 호출이 오류없이 잘 작성되셨나보네요!
저번에 계진님이 코멘트 달아주셨던 부분인데 계진님 코드 보면서 수정 반영해야겠습니다..😯

// updatedAt: "2022-07-11T09:42:24.894Z"
// user: "62aeb801f9b8ca611c46650b"
// __v: 0
// _id: "62cbf080cf52f92bfbddb2fa"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석은 임시로 작성해두신건가요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

값 보면서 하다가 안 지웠네요 지워야 합니다!

}

const FollowPageTab = ({ followingList, followersList }: Props) => {
const [selectedTab, setSelectedTab] = useState(0);
const FollowPageTab = ({ followingList, followerList }: Props) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 내영님이랑 겹치는 건가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 글쎄요... 어디가 겹친다는 말씀인 걸까요..?

@chogyejin chogyejin merged commit 17540d8 into main Jul 20, 2022
@sa02045 sa02045 deleted the fix/following-status branch July 24, 2022 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants