-
Notifications
You must be signed in to change notification settings - Fork 116
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
[김창민] week20 #1076
base: part3-김창민
Are you sure you want to change the base?
[김창민] week20 #1076
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 동작이 약간 다를 수 있으니 확인해보시면 좋겠네요
- react-hook-form 사용된 부분도 usePostSignup/usePostSignin으로 잘 대체해주신걸로 보여요
- react-hook-form의 handleSubmit에 바로 전달하는건 타입에러가 있었을 텐데, 그 이유도 알고가시면 좋겠습니다
}); | ||
} | ||
|
||
export function useGetUser() { |
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.
템플릿 코드에서 중요한차이가 userId를 인자로 받는지 여부군요.
use get user 기 때문에, 특정 user를 조회하는 기능을 가진 훅인데, userId를 받지 않는 다는 것만으로도 혼동을 줄만한 상황입니다. 템플릿코드를 참고해주세요. 아래라인에서 좀더 코멘트드릴게요
const data = responseData?.[0] && { | ||
id: responseData?.[0].id, | ||
name: responseData?.[0].name, | ||
email: responseData?.[0].email, | ||
imageSource: responseData?.[0].image_source, | ||
}; | ||
localStorage.setItem("userId", data.id); | ||
|
||
return data; | ||
}, | ||
enabled: !!token, |
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.
기존 코드에서처럼, !!userId가 추가되어야 react-query로 안정적으로 마이그레이션했다고 할 수 있을거같아요. 지금은 동작이 달라질걸로 보입니다. userId 없이 유저목록을 조회하고 그 중에 언제나 첫번째 유저를 반환할거라서요
enabled: !!token && !!userId
요구사항
기본
변경된 api를 활용해 주세요.
모달에 필요한 api 요청을 만들어 기능을 완성해 주세요.
api 요청에 TanStack React Query를 활용해 주세요.
Github에 위클리 미션 PR을 만들어 주세요.
React, Next.js를 사용해 진행합니다.
심화
주요 변경사항
스크린샷
멘토에게
커밋이 많지만 제일 마지막 커밋만 제가 작업한 파일입니다