Skip to content

[Refactor/#67] 인증코드 이메일 전송 응답값 변화에 따른 리팩토링#68

Open
Seojegyeong wants to merge 1 commit intodevelopfrom
refactor/#67
Open

[Refactor/#67] 인증코드 이메일 전송 응답값 변화에 따른 리팩토링#68
Seojegyeong wants to merge 1 commit intodevelopfrom
refactor/#67

Conversation

@Seojegyeong
Copy link
Collaborator

@Seojegyeong Seojegyeong commented Feb 27, 2026

🚨 관련 이슈

#67

✨ 변경사항

  • 🐞 BugFix Something isn't working
  • 💻 CrossBrowsing Browser compatibility
  • 🌏 Deploy Deploy
  • 🎨 Design Markup & styling
  • 📃 Docs Documentation writing and editing (README.md, etc.)
  • ✨ Feature Feature
  • 🔨 Refactor Code refactoring
  • ⚙️ Setting Development environment setup
  • ✅ Test Test related (storybook, jest, etc.)

✏️ 작업 내용

  • PROVIDER_NAME으로 소셜 한국어 변환
  • 백엔드 응답값에 맞추어 소셜 로그인으로 가입된 이메일로 이메일 회원가입 인증코드 발송 요청 시,
  • 가입된 계정임을 toast 메시지로 안내

😅 미완성 작업

N/A

📢 논의 사항 및 참고 사항

N/A

💬 리뷰어 가이드 (P-Rules)
P1: 필수 반영 (Critical) - 버그 가능성, 컨벤션 위반. 해결 전 머지 불가.
P2: 적극 권장 (Recommended) - 더 나은 대안 제시. 가급적 반영 권장.
P3: 제안 (Suggestion) - 아이디어 공유. 반영 여부는 드라이버 자율.
P4: 단순 확인/칭찬 (Nit) - 사소한 오타, 칭찬 등 피드백.

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 이메일 인증 시 해당 이메일이 소셜 로그인(Google, Kakao, Naver)으로 이미 등록된 경우를 감지하고 사용자에게 안내합니다.

@Seojegyeong Seojegyeong requested review from YermIm and jjjsun February 27, 2026 12:11
@Seojegyeong Seojegyeong self-assigned this Feb 27, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

이메일 인증 시 소셜 로그인으로 이미 연결된 이메일 주소를 감지하는 기능을 추가했습니다. 응답 타입에 isProviderLinkedproviderTypes 필드를 추가하고, 훅의 onSuccess에서 이 정보를 확인해 이미 연결된 이메일일 경우 사용자에게 안내 토스트를 표시합니다.

Changes

Cohort / File(s) Summary
Auth 타입 확장
src/types/auth/auth.ts
IEmailSendResponse 인터페이스에 isProviderLinked (boolean)와 providerTypes (TLoginProvider[]) 필드 추가
이메일 인증 훅 로직 개선
src/hooks/auth/useEmailVerification.ts
PROVIDER_NAME 매핑 추가 및 sendVerificationEmail의 onSuccess에서 소셜 로그인 연결 상태 확인 처리 구현

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

✨ Feature, 📬 API

Suggested reviewers

  • jjjsun
  • YermIm

추가 검토 포인트

변경사항이 깔끔하게 정리되어 있습니다. 다만 몇 가지 확인하면 좋을 것 같습니다:

  • 타입 안정성: providerTypes: TLoginProvider[]에서 실제로 백엔드에서 보내오는 데이터 구조가 배열인지 확인했는지 확인해 주세요.
  • 에러 처리: isProviderLinked가 true일 때 리턴하는 로직이 있는데, 이 경우 subsequent 처리(예: 상태 초기화 등)가 필요한지 검토하시면 좋겠습니다.
  • 사용자 경험: 소셜 로그인으로 이미 가입된 이메일 안내 메시지가 명확한지, 사용자가 다음 단계(로그인 or 가입)를 알 수 있는지 확인해 주세요.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 인증코드 이메일 전송 응답값 변화에 따른 리팩토링이라는 주요 변경사항을 명확하게 요약하고 있습니다.
Description check ✅ Passed PR 설명은 관련 이슈, 변경사항 체크박스, 상세한 작업 내용, 미완성 작업, 논의 사항을 모두 포함하며 템플릿을 충실히 따르고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#67

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

📚 Storybook 배포 완료

항목 링크
📖 Storybook https://69a147b60a56365d9e2185ef-xcjqjkskee.chromatic.com/
🔍 Chromatic https://www.chromatic.com/build?appId=69a147b60a56365d9e2185ef&number=11

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/hooks/auth/useEmailVerification.ts (2)

82-90: 매핑 결과 필터링 및 메시지 포맷 개선이 필요합니다.

  1. PROVIDER_NAME[type]undefined를 반환할 수 있으므로 필터링이 필요합니다.
  2. Line 87의 메시지에서 ${providerNames}계정 사이에 공백이 없어 "구글, 카카오계정으로" 형태로 표시됩니다. 가독성을 위해 공백 추가를 권장합니다.
♻️ 제안하는 수정 사항
          if (isProviderLinked) {
            const providerNames = providerTypes
              .map((type) => PROVIDER_NAME[type])
+             .filter(Boolean)
              .join(", ");
            toast.error("이미 소셜 로그인으로 가입된 이메일입니다.", {
-             description: `${providerNames}계정으로 로그인해주세요`,
+             description: `${providerNames} 계정으로 로그인해주세요`,
            });
            return;
          }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/auth/useEmailVerification.ts` around lines 82 - 90, The provider
name mapping in the isProviderLinked branch can produce undefined entries and
the final message lacks a space before "계정", so update the mapping of
providerTypes to use PROVIDER_NAME safely (e.g., map then filter out
undefined/falsey values or use a safe lookup) when building providerNames, and
change the toast.error description template to include a space before "계정" (use
`${providerNames} 계정으로 로그인해주세요`) so the message is both filtered and properly
spaced; refer to isProviderLinked, providerTypes, PROVIDER_NAME, and the
toast.error call to locate the change.

69-73: PROVIDER_NAME 상수를 훅 외부로 이동하세요.

현재 PROVIDER_NAME이 훅 내부에 정의되어 있어 매 렌더링마다 새로운 객체가 생성됩니다. 불변 상수이므로 훅 외부로 이동하여 불필요한 재생성을 방지하는 것이 좋습니다.

또한 TLoginProvider 타입에는 "EMAIL"도 포함되어 있는데, PROVIDER_NAME에는 해당 키가 없습니다. 만약 providerTypes"EMAIL"이 포함될 경우 undefined가 반환될 수 있습니다.

♻️ 제안하는 수정 사항
+const PROVIDER_NAME: Record<string, string> = {
+  GOOGLE: "구글",
+  KAKAO: "카카오",
+  NAVER: "네이버",
+};
+
 export const useEmailVerification = ({
   onNext,
   sendMutation,
 }: IUseEmailVerificationProps) => {
   const { setEmail } = useAuthStore();
   const { useSendCode, useCheckCode } = useAuth();
   const activeSendCode = sendMutation ?? useSendCode;

   const [sendCode, setSendCode] = useState(false);
   const [codeError, setCodeError] = useState("");
   // ... 생략
-
-  const PROVIDER_NAME: Record<string, string> = {
-    GOOGLE: "구글",
-    KAKAO: "카카오",
-    NAVER: "네이버",
-  };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/auth/useEmailVerification.ts` around lines 69 - 73, Move the
immutable PROVIDER_NAME constant out of the useEmailVerification hook to avoid
recreating the object on each render, and ensure it includes a mapping for
"EMAIL" (or handle missing keys) so lookups from providerTypes won't produce
undefined; update references to the constant inside useEmailVerification (search
for PROVIDER_NAME, useEmailVerification, TLoginProvider, and providerTypes) and
either add PROVIDER_NAME.EMAIL = "이메일" or add a safe fallback when resolving
provider names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/hooks/auth/useEmailVerification.ts`:
- Around line 82-90: The provider name mapping in the isProviderLinked branch
can produce undefined entries and the final message lacks a space before "계정",
so update the mapping of providerTypes to use PROVIDER_NAME safely (e.g., map
then filter out undefined/falsey values or use a safe lookup) when building
providerNames, and change the toast.error description template to include a
space before "계정" (use `${providerNames} 계정으로 로그인해주세요`) so the message is both
filtered and properly spaced; refer to isProviderLinked, providerTypes,
PROVIDER_NAME, and the toast.error call to locate the change.
- Around line 69-73: Move the immutable PROVIDER_NAME constant out of the
useEmailVerification hook to avoid recreating the object on each render, and
ensure it includes a mapping for "EMAIL" (or handle missing keys) so lookups
from providerTypes won't produce undefined; update references to the constant
inside useEmailVerification (search for PROVIDER_NAME, useEmailVerification,
TLoginProvider, and providerTypes) and either add PROVIDER_NAME.EMAIL = "이메일" or
add a safe fallback when resolving provider names.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfd37d4 and 288b52d.

📒 Files selected for processing (2)
  • src/hooks/auth/useEmailVerification.ts
  • src/types/auth/auth.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

♻️ [Refactor] 인증코드 전송 응답값 변화에 따른 리팩토링

1 participant