Skip to content

Commit

Permalink
Merge pull request #270 from FRONTENDSCHOOL5/feat/follow/#206
Browse files Browse the repository at this point in the history
[fix] 타계정 팔로워페이지 취소버튼 동작 방지 기능 구현 #206
  • Loading branch information
jjo-mi authored Aug 16, 2023
2 parents 41cf108 + 56d3374 commit a5d2813
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/pages/Follow/Followings/Followings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,25 @@ export default function Followers() {
);
console.log('선택한 구독자 정보: ', selectedFollower);

if (buttonStates[index]?.text === '취소') {
console.log('버튼 누르면 이벤트 값이 넘어와지는 확인중', followerId);
await getUnfollowUser(followerId, selectedFollower);
}
if (selectedFollower.accountname === user.accountname) {
if (buttonStates[index]?.text === '취소') {
console.log('버튼 누르면 이벤트 값이 넘어와지는 확인중', followerId);
await getUnfollowUser(followerId, selectedFollower);
}

//팔로우 취소 버튼
setButtonStates(prevStates => {
const updatedStates = [...prevStates];
updatedStates[index] = {
text: prevStates[index].text === '취소' ? '팔로우' : '취소',
className:
prevStates[index].className === styles['followers-btn-unfollow']
? styles['followers-btn-follow']
: styles['followers-btn-unfollow'],
};
return updatedStates;
});
//팔로우 취소 버튼
setButtonStates(prevStates => {
const updatedStates = [...prevStates];
updatedStates[index] = {
text: prevStates[index].text === '취소' ? '팔로우' : '취소',
className:
prevStates[index].className === styles['followers-btn-unfollow']
? styles['followers-btn-follow']
: styles['followers-btn-unfollow'],
};
return updatedStates;
});
}
};

return (
Expand Down

0 comments on commit a5d2813

Please sign in to comment.