Skip to content

Conversation

@yoorli
Copy link
Member

@yoorli yoorli commented Dec 12, 2025

📝 변경 사항

💡package.json

  • js-cookie, @types/js-cookie 의존성 추가
    • 클라이언트 환경에서 userId를 쿠키로 관리하기 위한 라이브러리 추가

💡src/hooks/use-auth/use-auth-login.*

  • API.authService.login을 호출하는 useLogin 훅 구현
    • LoginRequest 타입을 인자로 받아 로그인 API 호출
    • 응답에서 userId 등 로그인 결과를 반환받도록 타입 정의 수정
  • 로그인 성공 시 처리
    • js-cookie를 사용해 userId를 브라우저 쿠키에 저장 (Cookies.set('userId', String(result.userId)) 형태)
    • 폼에서 전달받은 formApi.reset() 호출로 입력값 초기화
    • router.push('/')를 통해 홈으로 이동

💡src/hooks/use-auth/use-auth-logout.*

  • API.authService.logout을 호출하는 useLogout 훅 구현
    • 서버에 로그아웃 요청을 전송
  • 로그아웃 성공 시 처리
    • js-cookie를 사용해 로그인 시 저장한 userId 쿠키 제거
    • 필요 시 라우팅 처리(router.push('/') 등)를 통해 초기 화면으로 이동할 수 있도록 구성

💡src/hooks/use-auth/use-auth-signup.*

  • API.authService.signup을 호출하는 useSignup 훅 구현
    • 회원가입 폼에서 공통적으로 사용할 수 있는 API 호출 로직을 훅으로 분리
  • 회원가입 성공 시 처리
    • 폼 리셋 및 /login 페이지로 이동하는 흐름을 제공노출할 수 있도록 설계

💡src/hooks/use-auth/use-auth-withdraw.*

  • 회원탈퇴용 useWithdraw 훅 구현
    • API.usersService.deleteMe(또는 이에 상응하는 회원탈퇴 API) 호출
    • 기존에 Promise 중복으로 작성되어 있던 부분을 정리하고, 단일 비동기 함수로 탈퇴 로직을 캡슐화
  • 회원탈퇴 성공 시 처리
    • userId 쿠키 제거
    • 로그아웃과 동일하게 세션 정리 후 초기 화면 또는 적절한 페이지로 이동할 수 있도록 설계

💡src/lib/schema/auth.ts

  • loginSchema, signupSchema 등 auth 관련 스키마의 유효성 검사 조건 변경 및 추가
    • 이메일/닉네임/비밀번호 등 필드별 제약 조건을 조정
    • 입력 길이, 패턴, 선택 여부 등의 규칙을 Zod 레벨에서 최대한 강제하도록 개선

💡src/components/pages/login/*

  • 로그인 폼에서 직접 API를 호출하던 로직을 제거하고 useLogin 훅 사용으로 전환
  • 임시 로그아웃/회원탈퇴 버튼 컴포넌트 추가

💡src/types/service/auth.ts

  • LoginResponse 타입에 userId 필드를 추가/수정

🔗 관련 이슈

Closes #122


🧪 테스트 방법

  • 수동 테스트 검증(로컬 환경)
  • 유닛 테스트 검증
  • 통합 테스트 검증

📸 스크린샷 (선택)


📋 체크리스트

  • 관련 문서를 업데이트했습니다 (필요한 경우)
  • 테스트를 추가/수정했습니다 (필요한 경우)
  • Breaking change가 있다면 명시했습니다

💬 추가 코멘트


CodeRabbit Review는 자동으로 실행되지 않습니다.

Review를 실행하려면 comment에 아래와 같이 작성해주세요

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yoolri-feat/api

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

github-actions bot commented Dec 12, 2025

🎭 Playwright Report

E2E Test가 성공적으로 완료되었습니다.

Test 요약 내용을 확인해주세요.

Status Build Log Updated (UTC)
✅ Ready View Build 2025-12-12 05:56:47

📊 Test Summary

  • ✅ Passed: 3
  • ❌ Failed: 0
  • ⏱️ Duration: 37.1s

📜 Test Details

✅ Passed Tests (3)
  • profile.test.ts (3)
    • [chromium] 존재하지 않는 프로필 페이지로 접속 시 404 리다이렉트 되는 지 테스트
    • [firefox] 존재하지 않는 프로필 페이지로 접속 시 404 리다이렉트 되는 지 테스트
    • [webkit] 존재하지 않는 프로필 페이지로 접속 시 404 리다이렉트 되는 지 테스트

@github-actions
Copy link

github-actions bot commented Dec 12, 2025

🎨 Storybook Report

변경 사항이 없습니다

모든 Story가 이전 빌드와 동일합니다.

Status Storybook Build Log Updated (UTC)
✅ Unchanged View Storybook View Build 2025-12-12 05:56:40

@github-actions
Copy link

github-actions bot commented Dec 12, 2025

📊 Coverage Report

Status Build Log Updated (UTC)
✅ Ready View Build 2025-12-12 05:55:22

📉 #164main에 병합하면 coverage가 0.86% 감소합니다.

Coverage 요약

@@             Coverage Diff             @@
##             main     #164       +/-   ##
===========================================
- Coverage   39.18%   38.32%    -0.86%     
===========================================
  Files         131      136        +5     
  Lines        5280     5406      +126     
  Branches      220      225        +5     
===========================================
+ Hits         2069     2072        +3     
+ Misses       3211     3334      +123     

영향받은 파일

파일 Coverage 변화
/home/runner/work/WeGo_FrontEnd/WeGo_FrontEnd/src/api/service/auth-service/index.ts 61.90% (-0.26%) ⬇️

@github-actions
Copy link

github-actions bot commented Dec 12, 2025

🚀 PR Preview Report

Build가 성공적으로 완료되었습니다.

Preview에서 변경사항을 확인하세요.

Status Preview Build Log Updated (UTC)
✅ Ready Visit Preview View Logs 2025-12-12 05:56:17

@yoorli yoorli added the Ready For Review! 리뷰 받을 준비가 되었습니다. label Dec 12, 2025
Copy link
Member

@Chiman2937 Chiman2937 left a comment

Choose a reason for hiding this comment

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

수고 하셨습니다~

@Chiman2937 Chiman2937 merged commit 1410884 into main Dec 12, 2025
9 checks passed
@Chiman2937 Chiman2937 deleted the yoolri-feat/api branch December 12, 2025 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready For Review! 리뷰 받을 준비가 되었습니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[로그인/회원가입 페이지] API 연동

3 participants