Skip to content

Commit

Permalink
[fix] 타계정 팔로워페이지 취소버튼 동작 방지 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jjo-mi committed Aug 16, 2023
1 parent 4741700 commit 56d3374
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 56d3374

Please sign in to comment.