-
Notifications
You must be signed in to change notification settings - Fork 8
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
프로필 화면에서 팔로우 버튼 활성화, 기타 관련 기능 구현 #99
Conversation
user데이터를 fetch 하는 useEffect에 유저 변경 의존성 추가
조회 시 모든 field를 가져오도록 수정
뒤로가기 버튼이 home으로 이동에서 바로 이전으로 이동
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
짧은 시간에 많은 기능을 구현하셨네요 ㅎㅎ
고생하셨습니다!
setLoading(false); | ||
}); | ||
}, []); | ||
console.log(props.userData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 콘솔로그가 찍혀있네요 ㅋㅋㅋㅋㅌ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 확인을 못했네요 ㅜ
|
||
return ( | ||
<UserCardLayout sizeType={props.cardType}> | ||
<UserCardLayout onClick={() => props.cardType !== 'others' && history.push(`/profile/${props.userData.userId}`)} sizeType={props.cardType}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오늘 Link로 하면 스타일 이슈가 생길 수도 있다고 하셨는데 그래서 history를 사용한건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
props.cardType이 others인 경우에는 링크가 걸리면 안되서 히스토리 사용했습니다!
fetch(`${process.env.REACT_APP_API_URL}/api/user/follow`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
body: JSON.stringify({ type, targetUserDocumentId }), | ||
}).then((res) => res.json()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API 폴더에 빼도 좋을 거 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네네 오늘 리팩토링 해볼게요!
description: string, | ||
profileUrl: string, | ||
isFollow?: boolean, | ||
} | ||
|
||
function FollowerView({ match }: RouteComponentProps<{id: string}>) { | ||
const userId = match.params.id; | ||
const [nowItemList, nowItemType] = useFetchItems<any>(`/user/followers/${userId}`, 'followers'); | ||
const [nowItemList, nowItemType] = useFetchItems<Required<IUserForCard>>(`/user/followers/${userId}`, 'followers'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 Require도 있군요! 배워갑니다 ㅎㅎㅎ
interface IUserForCard{ | ||
_id: string, | ||
userName: string, | ||
userId: string, | ||
description: string, | ||
profileUrl: string, | ||
isFollow?: boolean, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follower-view에도 있는 인터페이스네요 저도 종종 자주 쓰이는 인터페이스가 있는데 저런 공통부분을 폴더를 만들어서 관리할까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여러곳에서 쓰이는 interface는 폴더를 만들면 좋겠다는 생각이 듭니다!
개요
작업사항
변경 후