Skip to content

Nextjs 로그아웃 연동 : feat : 에러코드 업데이트 & route.ts 내부 로컬 쿠키 분기 시 res 반환 ht…#15

Merged
Chuseok22 merged 1 commit intomainfrom
20250916_#6_기능추가_인증_Nextjs_로그아웃_연동
Sep 17, 2025

Hidden character warning

The head ref may contain hidden characters: "20250916_#6_\uae30\ub2a5\ucd94\uac00_\uc778\uc99d_Nextjs_\ub85c\uadf8\uc544\uc6c3_\uc5f0\ub3d9"
Merged

Nextjs 로그아웃 연동 : feat : 에러코드 업데이트 & route.ts 내부 로컬 쿠키 분기 시 res 반환 ht…#15
Chuseok22 merged 1 commit intomainfrom
20250916_#6_기능추가_인증_Nextjs_로그아웃_연동

Conversation

@Chuseok22
Copy link
Member

@Chuseok22 Chuseok22 commented Sep 17, 2025

…tps://github.com//issues/6

Summary by CodeRabbit

  • New Features
    • 오류 안내 확장: 서버 연결 불가(502), 네트워크 오류(503), 요청 지연(504), 알 수 없는 오류(500)에 대한 사용자 메시지를 추가하여 상황별 안내를 제공합니다.
    • 로그인 실패 메시지를 “아이디 또는 비밀번호를 확인하세요.”로 변경해 안내를 명확히 했습니다.
  • Bug Fixes
    • 로컬 환경에서 로그인 요청의 응답 처리를 안정화하여, 필요한 경우 쿠키가 포함된 정상 응답이 즉시 반환되도록 개선했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Sep 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

로그인 POST 핸들러의 localhost 분기에서 로컬 응답을 즉시 반환하도록 수정되었습니다. 비-localhost 경로는 기존 흐름을 유지합니다. 또한 에러 코드 모듈에 네트워크/타임아웃/업스트림/알 수 없음 관련 코드가 추가되고, 로그인 실패 메시지가 변경되었습니다.

Changes

Cohort / File(s) Summary of Changes
Login API 흐름 수정
src/app/api/login/route.ts
localhost 분기에서 로컬 NextResponse를 즉시 return하도록 변경. 쿠키 설정은 data.accessToken 존재 시 유지. 비-localhost 경로의 상위 반환 로직은 변경 없음.
에러 코드 확장/수정
src/lib/error/error-code.ts
UPSTREAM_UNREACHABLE(502), NETWORK_ERROR(503), TIMEOUT(504), UNKNOWN_ERROR(500) 추가. LOGIN_FAILED 메시지를 '아이디 또는 비밀번호를 확인하세요.'로 변경.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant R as Login API (route.ts)
  participant U as Upstream Auth

  Note over R: POST /api/login
  alt isLocalhost()
    rect rgba(200,240,255,0.2)
      C->>R: Credentials
      R->>U: Forward login (optional in dev)
      U-->>R: { ok, data } / error
      R->>C: Return local NextResponse<br/>(sets accessToken cookie if present)
      Note right of R: 변경점: localhost에서 즉시 반환
    end
  else non-localhost
    C->>R: Credentials
    R->>U: Forward login
    U-->>R: { ok, data } / error
    R-->>C: Upstream 기반 응답 반환
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

새벽 깃발, 로컬의 문
쿠키 한 조각, 곧장 건네주고 둥근 눈
바람 탄 에러 코드 네 잎의 클로버 🌿
타임아웃, 네트워크도 이름을 얻었네
폴짝! 로그인 길이 한층 또렷해졌지 🐇

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 20250916_#6_기능추가_인증_Nextjs_로그아웃_연동

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b73399 and 03b4eca.

📒 Files selected for processing (2)
  • src/app/api/login/route.ts (1 hunks)
  • src/lib/error/error-code.ts (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@Chuseok22 Chuseok22 merged commit 1fc614b into main Sep 17, 2025
1 of 2 checks passed
@Chuseok22 Chuseok22 linked an issue Sep 17, 2025 that may be closed by this pull request
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.

⚙️ [기능추가][인증] Next.js 로그아웃 연동

1 participant