Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
개요
로그인 전에는 아래와 같이 되어있다가 로그인을 완료하면


아래와 같이 이름과 이미지를 불러옵니다.
상세 작업내용
1.
userState, 전역 상태 추가이름과 이미지 외에도 아래와 같은 내용을 불러올 수 있으며, 해당 내용은
src/state/user.js에서도 확인하실 수 있습니다 :)2.
userState제어를 위한 커스텀훅 구현src/hooks/user폴더를 보시면userState를 제어하기 위한 커스텀 훅들이 구현되어있습니다!중점적으로 보시면 좋은 hook은
useUserLogin과useUserProfile이며 각각로그인이되었는지, 로그인요청함수와유저이미지, 유저이름, 유저깃허브url을 반환합니다.3. 깃허브 로그인 구현
동작 원리는
code라는 값이 추가되어 돌아오게됩니다.useSearchParams와useEffect를 이용하여code값이 감지되면 이를 기반으로 로그인을 요청합니다. 로그인 로직은useUserLogin훅스를 참고하시면 됩니다! 로그인에 성공하면 유저정보는 sessionStorage에 저장됩니다.useUserLogin훅스의 반환값으로 얻을 수 있는isLoggedIn으로 로그인 상태를 알 수 있으며, 로그인이 되어있는 경우 로그인 버튼이 아닌 유저의 값을 표기합니다.관련 이슈