-
Notifications
You must be signed in to change notification settings - Fork 3
feat: 소셜 로그인 통합 및 상태 관리, 라우터 레이아웃 분리 #23
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
feat: 소셜 로그인 통합 및 상태 관리, 라우터 레이아웃 분리 #23
Conversation
tkyoun0421
left a comment
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.
고생 많이 하셨습니다 🙇
| const socialLogin = async (provider: AuthProvider): Promise<void> => { | ||
| try { | ||
| const result = await signInWithPopup(auth, provider); | ||
| const user = result.user; | ||
|
|
||
| console.log("소셜 로그인 성공: ", user); | ||
| navigate("/"); | ||
| } catch (error: any) { | ||
| console.error("소셜 로그인 실패: ", error); | ||
|
|
||
| if (error.code !== "auth/account-exists-with-different-credential") | ||
| return; | ||
|
|
||
| const email = error.customData?.email; | ||
| if (!email) { | ||
| alert("이메일 정보를 가져올 수 없습니다."); | ||
| return; | ||
| } | ||
|
|
||
| const methods = await fetchSignInMethodsForEmail(auth, email); | ||
| if (methods.length === 0) { | ||
| alert("이미 다른 로그인 방법으로 가입된 이메일입니다."); | ||
| return; | ||
| } | ||
|
|
||
| if (methods.includes("google.com")) { | ||
| alert( | ||
| "이미 Google 계정으로 가입된 이메일입니다. Google 로그인을 이용해주세요." | ||
| ); | ||
| } else { | ||
| alert(`이미 가입된 로그인 방법: ${methods.join(", ")}`); | ||
| } | ||
| } | ||
| }; | ||
|
|
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.
옙! 수정했습니다 ㅋㅋㅋㅋ
czmcm5
left a comment
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.
정말 빠르네요 ~! 😄
d06c76f
into
amicable-development-center:develop
개요
소셜 로그인 기능을 통합하여 재사용성을 개선하였고, Zustand 기반 전역 인증 상태를 추가하였습니다.
또한 로그인/회원가입 페이지에서 Header가 보이지 않도록 라우터 레이아웃을 분리하였습니다.
변경 사항
구현 내용
Zustand 기반 전역 인증 상태 관리 로직 추가
Github, Google 소셜 로그인 통합 훅 구현 (코멘트 반영 수정)
Header 컴포넌트 생성 및 로그인/로그아웃 버튼 상태 분기 적용
로그인/로그아웃 버튼 features 레이어로 이동
라우터 레이아웃 분리: 로그인/회원가입 페이지에서 Header 제거
소셜 로그인 훅 통합 및 LoginForm 내 훅 호출 구조 수정
개발 후기 및 개선사항
이번 작업에서 배운 점
어려웠던 점 / 에로사항
다음에 개선하고 싶은 점
팀원들과 공유하고 싶은 팁