Skip to content

Commit

Permalink
fix: userid 수정 교체 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
KimKyuHoi authored Jan 12, 2025
1 parent b9eafab commit 23670ab
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/pages/mypage/components/MUserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,26 @@ const USER_ROLE: { [id: string]: string } = {
function MUserProfile({ userProfile }: UserProfileProps) {
const { isModalOpen, openModal, closeModal } = useModal();
const [modalProps, setModalProps] = useState<ImodalProps>(() => ({
userid: userProfile.id,
userid: -1,
follow: '',
isMine: userProfile.isMine,
}));

useEffect(() => {
if (userProfile.id) {
setModalProps(prevModalProps => ({
...prevModalProps,
userid: userProfile.id,
}));
}
}, [userProfile.id]);

const handleModal = (e: React.MouseEvent<HTMLDivElement>) => {
let follow = e.currentTarget.dataset.type;
setModalProps({ ...modalProps, follow });
setModalProps(prevModalProps => ({
...prevModalProps,
follow,
}));
openModal();
};

Expand Down

0 comments on commit 23670ab

Please sign in to comment.