Skip to content

Conversation

@namee-h
Copy link
Contributor

@namee-h namee-h commented Jun 24, 2025

개요

소셜 로그인 기능을 통합하여 재사용성을 개선하였고, Zustand 기반 전역 인증 상태를 추가하였습니다.
또한 로그인/회원가입 페이지에서 Header가 보이지 않도록 라우터 레이아웃을 분리하였습니다.

변경 사항

  • 새로운 기능 추가
  • 버그 수정
  • 리팩토링
  • 문서 수정

구현 내용

Zustand 기반 전역 인증 상태 관리 로직 추가
Github, Google 소셜 로그인 통합 훅 구현 (코멘트 반영 수정)
Header 컴포넌트 생성 및 로그인/로그아웃 버튼 상태 분기 적용
로그인/로그아웃 버튼 features 레이어로 이동
라우터 레이아웃 분리: 로그인/회원가입 페이지에서 Header 제거
소셜 로그인 훅 통합 및 LoginForm 내 훅 호출 구조 수정

개발 후기 및 개선사항

이번 작업에서 배운 점

  • (없다면 패스)

어려웠던 점 / 에로사항

  • Conventional Commit을 통한 커밋 메시지 규칙 적응
  • 레이아웃 분리 시 Route element 설계 고민

다음에 개선하고 싶은 점

  • 라우터 가드 (Protected Route) 적용
  • 해더에 등록페이지 검색페이지 이동 연결

팀원들과 공유하고 싶은 팁

  • (없다면 패스)

Copy link
Contributor

@tkyoun0421 tkyoun0421 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생 많이 하셨습니다 🙇

Comment on lines +12 to +46
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(", ")}`);
}
}
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바꿔주셨네요!! 👍 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옙! 수정했습니다 ㅋㅋㅋㅋ

@tkyoun0421 tkyoun0421 added the status: done 작업 완료 label Jun 24, 2025
Copy link
Contributor

@czmcm5 czmcm5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정말 빠르네요 ~! 😄

@tkyoun0421 tkyoun0421 merged commit d06c76f into amicable-development-center:develop Jun 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: done 작업 완료

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants