[Refactor/#67] 인증코드 이메일 전송 응답값 변화에 따른 리팩토링#68
Conversation
📝 WalkthroughWalkthrough이메일 인증 시 소셜 로그인으로 이미 연결된 이메일 주소를 감지하는 기능을 추가했습니다. 응답 타입에 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
추가 검토 포인트변경사항이 깔끔하게 정리되어 있습니다. 다만 몇 가지 확인하면 좋을 것 같습니다:
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
📚 Storybook 배포 완료
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/hooks/auth/useEmailVerification.ts (2)
82-90: 매핑 결과 필터링 및 메시지 포맷 개선이 필요합니다.
PROVIDER_NAME[type]이undefined를 반환할 수 있으므로 필터링이 필요합니다.- 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.
🚨 관련 이슈
#67
✨ 변경사항
✏️ 작업 내용
PROVIDER_NAME으로 소셜 한국어 변환😅 미완성 작업
N/A
📢 논의 사항 및 참고 사항
N/A
Summary by CodeRabbit
릴리스 노트