Skip to content

Conversation

@namee-h
Copy link
Contributor

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

개요

이 PR의 목적과 구현 내용을 간단히 설명합니다.

변경 사항

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

구현 내용

firebase.ts 연동
loginPage 대략적인 ui 구현

개발 후기 및 개선사항

이번 작업에서 배운 점

.env 파일의 위치: root가 항상 src 이지 않음! ㅠㅠ
vite.config.ts 파일 확인하고 진짜 root 가 어디인지 확인 해야함!!

어려웠던 점 / 에로사항

  • 구글 로그인 하고나서 다시 깃허브로도 확인해보려 했으나
  • 로그인 이메일이 동일하여 에러가남
  • 해당 부분을 예외사항 처리하였으나 아직 미흡함

다음에 개선하고 싶은 점

  • 위 에로사항을 팀원들과 공유하고 개선하고 싶음

팀원들과 공유하고 싶은 팁

  • src>app>.env !!!!!!!

@tkyoun0421 tkyoun0421 assigned tkyoun0421 and namee-h and unassigned tkyoun0421 Jun 24, 2025
@tkyoun0421 tkyoun0421 added the status: done 작업 완료 label Jun 24, 2025
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.

고생하셨습니다 🙇
env 부분 제가 말씀 드렸어야 했는데.. 놓친 부분을 잘 챙겨주셔서 감사합니다 ㅠㅠ 고생 많으셨어요

Comment on lines +21 to +48
if (error.code === "auth/account-exists-with-different-credential") {
const email = error.customData?.email;

if (email) {
const methods = await fetchSignInMethodsForEmail(auth, email);
console.warn("이미 가입된 로그인 방법:", methods);

if (methods.length > 0) {
if (methods.includes("google.com")) {
alert(
"이미 Google 계정으로 가입된 이메일입니다. Google 로그인을 이용해주세요."
);
} else {
alert(`이미 가입된 로그인 방법: ${methods.join(", ")}`);
}
} else {
alert(
"이미 다른 로그인 방법으로 가입된 이메일입니다. 다른 로그인 방법을 사용해주세요."
);
}
} else {
alert(
"이미 다른 로그인 방법으로 가입된 계정입니다. 이메일 정보를 가져올 수 없습니다."
);
}
}
}
};
Copy link
Contributor

@tkyoun0421 tkyoun0421 Jun 24, 2025

Choose a reason for hiding this comment

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

early return 방식을 해보시는 것도 추천 드립니다.
if depth가 줄어서 코드 가독성이 좋아질 수 있을거에요!!

Comment on lines +6 to +21
const useGoogleLogin = (): { googleLogin: () => Promise<void> } => {
const navigate = useNavigate();

const googleLogin = async (): Promise<void> => {
try {
const result = await signInWithPopup(auth, googleProvider);
const user = result.user;

console.log("Google 로그인 성공: ", user);
navigate("/");
} catch (error) {
console.error("Google 로그인 실패: ", error);
}
};

return { googleLogin };
Copy link
Contributor

@tkyoun0421 tkyoun0421 Jun 24, 2025

Choose a reason for hiding this comment

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

위에 useGithubLogin과 동일한 로직인거로 보입니다!
hook 인자로 provider를 제공받아 사용하여 재사용성 좋게 관리하면
혹시 나중에 다른 OAuth 서비스를 제공하더라도 같은 로직을 여러번 작성하지 않을 수 있을 것 같습니다!

Comment on lines +10 to +17
const SocialButton = styled(Button)({
width: "100%",
marginBottom: "16px",
textTransform: "none",
display: "flex",
alignItems: "center",
justifyContent: "center",
});
Copy link
Contributor

Choose a reason for hiding this comment

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

styled component는 render component export 아래에 선언해주시면 감사하겠습니다 🙇

@czmcm5
Copy link
Contributor

czmcm5 commented Jun 24, 2025

제가 .env 확인까지 하고 갔어야 했는데 ㅠㅠ 고생해주신 사라님 정말정말 감사합니다!! 덕분에 에러없었어요 💪

@tkyoun0421 tkyoun0421 merged commit c6fe0af 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