Skip to content

Refactor/client api caller #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

Unknown-Box
Copy link
Collaborator

@Unknown-Box Unknown-Box commented Feb 16, 2025

๐Ÿ“ Issue ๋ฒˆํ˜ธ

#57

๐Ÿ› ๏ธ PR ์„ธ๋ถ€ ๋‚ด์šฉ

client-side api ํ˜ธ์ถœ์„ ์œ„ํ•œ wrapper ํ•จ์ˆ˜ ์ œ์ž‘ -> signin, signup ์ ์šฉ

Summary by CodeRabbit

  • New Features

    • ๋กœ๊ทธ์ธ ๋ฐ ํšŒ์›๊ฐ€์ž… ํ๋ฆ„์ด ๊ฐ„์†Œํ™”๋˜์–ด, ๋ณด๋‹ค ๋น ๋ฅด๊ณ  ์•ˆ์ •์ ์ธ ์ธ์ฆ ๊ฒฝํ—˜์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
    • ์นด์นด์˜ค๋ฅผ ํ†ตํ•œ ๊ฐ„ํŽธ ๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์–ด, ๋‹ค์–‘ํ•œ ๋กœ๊ทธ์ธ ์˜ต์…˜์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
  • Refactor

    • ์ธ์ฆ ์ฒ˜๋ฆฌ ๋ฐ ์˜ค๋ฅ˜ ์•ˆ๋‚ด ๋ฐฉ์‹์ด ๊ฐœ์„ ๋˜์–ด, ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ณด๋‹ค ๋ช…ํ™•ํ•œ ํ”ผ๋“œ๋ฐฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Copy link

vercel bot commented Feb 16, 2025

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
madcamp-week4 โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Feb 16, 2025 8:03am

Copy link
Contributor

coderabbitai bot commented Feb 16, 2025

Walkthrough

์ด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋Š” ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ์ธก์—์„œ ๋กœ๊ทธ์ธ, ํšŒ์›๊ฐ€์ž… ๋ฐ API ์š”์ฒญ ์ฒ˜๋ฆฌ ๋ฐฉ์‹์„ ๋ฆฌํŒฉํ† ๋งํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ๊ณผ ํšŒ์›๊ฐ€์ž… ํŽ˜์ด์ง€์—์„œ๋Š” axios ํ˜ธ์ถœ ๋Œ€์‹  ๊ฐ๊ฐ signIn๊ณผ signUp ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, JWT ์œ ํ‹ธ๋ฆฌํ‹ฐ๋ฅผ ํ†ตํ•œ ํ† ํฐ ๊ด€๋ฆฌ๊ฐ€ ๋„์ž…๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ๊ณตํ†ต API ์š”์ฒญ ๋ชจ๋“ˆ์— ์ปค์Šคํ…€ ์˜ˆ์™ธ ํด๋ž˜์Šค์™€ API ๋นŒ๋”๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , ๋””๋ฒ„๊ทธ ๊ด€๋ จ ๋ชจ๋“ˆ์—์„œ process ๋ชจ๋“ˆ์˜ ๋ช…์‹œ์  ์ž„ํฌํŠธ๊ฐ€ ์ œ๊ฑฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ, tsconfig์˜ moduleResolution ์˜ต์…˜์ด ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๋ณ€๊ฒฝ ์š”์•ฝ
client/src/pages/(index.tsx, signup/index.tsx) ๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž… ์ฒ˜๋ฆฌ์—์„œ axios ํ˜ธ์ถœ ์ œ๊ฑฐ, ๊ฐ๊ฐ signIn ๋ฐ signUp ํ•จ์ˆ˜ ์‚ฌ์šฉ, JWT๋ฅผ ํ†ตํ•œ ํ† ํฐ ๊ด€๋ฆฌ ๋„์ž…, ์ปค์Šคํ…€ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ์ ์šฉ
client/src/utils/apis/accounts.ts ๋กœ๊ทธ์ธ, ์นด์นด์˜ค ๋กœ๊ทธ์ธ ๋ฐ ํšŒ์›๊ฐ€์ž…์„ ์œ„ํ•œ API ์—”๋“œํฌ์ธํŠธ(signIn, kakaoSignIn, signUp) ์ถ”๊ฐ€
client/src/utils/apis/common.ts BASE_URL ์ƒ์ˆ˜, HTTP ์˜ˆ์™ธ ํด๋ž˜์Šค(์˜ˆ: BadRequestException, NotFoundException ๋“ฑ)์™€ API ์š”์ฒญ์„ ์œ„ํ•œ ApiBuilder ํด๋ž˜์Šค ์ถ”๊ฐ€, ๋ณด์กฐ์šฉ ApiBuilder2 ๋„์ž…
client/src/utils/apis/token.ts JWT์˜ ๋ฌธ์ž์—ด ๋ณ€ํ™˜, Bearer ํ† ํฐ ํฌ๋งท, ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ์ €์žฅ/์กฐํšŒ ๊ธฐ๋Šฅ์„ ํฌํ•จํ•œ Jwt ํด๋ž˜์Šค ์ถ”๊ฐ€
client/src/utils/debug.ts, server/src/utils/debug.ts process ๋ชจ๋“ˆ์˜ ๋ช…์‹œ์  ์ž„ํฌํŠธ ์ œ๊ฑฐ (์ „์—ญ process ๊ฐ์ฒด ์‚ฌ์šฉ)
client/tsconfig.json moduleResolution ์˜ต์…˜์ด "node"์—์„œ "node10"์œผ๋กœ ๋ณ€๊ฒฝ๋จ

Sequence Diagram(s)

sequenceDiagram
    participant User as ์‚ฌ์šฉ์ž
    participant LoginPage as ๋กœ๊ทธ์ธ ํ™”๋ฉด
    participant SignInAPI as signIn ํ•จ์ˆ˜
    participant Jwt as JWT ์œ ํ‹ธ๋ฆฌํ‹ฐ
    participant LocalStorage as ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€

    User->>LoginPage: ๋กœ๊ทธ์ธ ์ •๋ณด ์ž…๋ ฅ (์ด๋ฉ”์ผ, ๋น„๋ฐ€๋ฒˆํ˜ธ)
    LoginPage->>SignInAPI: signIn ํ˜ธ์ถœ
    SignInAPI-->>LoginPage: ์‘๋‹ต (accessToken)
    LoginPage->>Jwt: Jwt.fromString(accessToken) ํ˜ธ์ถœ
    Jwt-->>LoginPage: ํ† ํฐ ๊ฐ์ฒด ๋ฐ˜ํ™˜
    LoginPage->>LocalStorage: token.storeToLocalStorage() ์‹คํ–‰
    LoginPage->>User: ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์ฒ˜๋ฆฌ
Loading
sequenceDiagram
    participant User as ์‚ฌ์šฉ์ž
    participant SignupPage as ํšŒ์›๊ฐ€์ž… ํ™”๋ฉด
    participant SignUpAPI as signUp ํ•จ์ˆ˜
    participant Debug as debugPrint ํ•จ์ˆ˜

    User->>SignupPage: ํšŒ์›๊ฐ€์ž… ์ •๋ณด ์ž…๋ ฅ
    SignupPage->>SignUpAPI: signUp ํ˜ธ์ถœ
    SignUpAPI-->>SignupPage: ์‘๋‹ต (user id)
    SignupPage->>Debug: debugPrint(user id) ์‹คํ–‰
    SignupPage->>User: ํšŒ์›๊ฐ€์ž… ์™„๋ฃŒ ์‘๋‹ต
Loading
โœจ Finishing Touches
  • ๐Ÿ“ Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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.

Actionable comments posted: 2

๐Ÿงน Nitpick comments (12)
client/src/utils/apis/common.ts (5)

1-5: ํ™˜๊ฒฝ ๋ถ„๋ฆฌ์— ๋Œ€ํ•œ ๊ณ ๋ ค ๊ถŒ์žฅ
BASE_URL์ด ํ•˜๋“œ์ฝ”๋”ฉ๋˜์–ด ์žˆ์–ด, ํ”„๋กœ๋•์…˜/๊ฐœ๋ฐœ ํ™˜๊ฒฝ๋ณ„๋กœ ๋‹ค๋ฅธ URL์„ ์ ์šฉํ•˜๊ธฐ ์–ด๋ ค์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์•ˆ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”.


23-51: ์—๋Ÿฌ ์ „์šฉ ํด๋ž˜์Šค ์„ธ๋ถ„ํ™”
400~500๋Œ€ ์—๋Ÿฌ๋ฅผ ๊ตฌ์ฒด์ ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์กŒ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ ๊ณตํ†ต ๋กœ์ง์ด ๋ฐ˜๋ณต๋˜๋ฏ€๋กœ, ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ƒ์„ฑ์ž ๋กœ์ง์„ ์ถ”์ƒํ™”ํ•ด ์ค‘๋ณต์„ ์ค„์ผ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.


90-109: getContentType ํ•จ์ˆ˜ ๊ตฌ์กฐ
headers ๋ฐฐ์—ด์„ ์ˆœํšŒํ•˜์—ฌ Content-Type์„ ํŒ๋ณ„ํ•˜๋Š” ๋กœ์ง์ด ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค. ์ถ”ํ›„ Content-Type ์œ ํ˜•์ด ๋” ๋Š˜์–ด๋‚  ๊ฒฝ์šฐ๋ฅผ ๋Œ€๋น„ํ•ด ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๋„๋ก switch๋‚˜ ๋งคํ•‘ ๊ตฌ์กฐ๋ฅผ ๋„์ž…ํ•˜๋Š” ๊ฒƒ๋„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”.


111-127: getResponseContentType ํ•จ์ˆ˜ ๋‚ด ์ฝ˜์†” ์ถœ๋ ฅ
๊ฐœ๋ฐœ ๊ณผ์ •์—์„œ ์ •๋ณด๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด console.log๊ฐ€ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ๋Š” ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜ ๋กœ๊น… ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ๋Œ€์ฒดํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.


129-213: inner ๋ฉ”์„œ๋“œ์˜ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋กœ์ง
HTTP ์ƒํƒœ ์ฝ”๋“œ๋ณ„๋กœ ์ ์ ˆํ•œ ์ปค์Šคํ…€ ์˜ˆ์™ธ ํด๋ž˜์Šค๋ฅผ ๋˜์ ธ์„œ ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ์—๋Ÿฌ ํ๋ฆ„์ด ํ™•๋ณด๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์„œ๋ฒ„์—์„œ ์ „๋‹ฌํ•œ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋‚˜ ์ƒ์„ธ ์ •๋ณด๊ฐ€ ์žˆ๋‹ค๋ฉด ํ•จ๊ป˜ ํฌํ•จํ•ด ์ฃผ๋ฉด ๋””๋ฒ„๊น…์— ์œ ์ตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

client/src/utils/apis/accounts.ts (3)

1-3: ๋ถˆํ•„์š”ํ•œ ๊ณต๋ฐฑ ๋ผ์ธ ํ™•์ธ
์ค„๋ฐ”๊ฟˆ์ด ์žฆ์•„ ํŒŒ์ผ์ด ์กฐ๊ธˆ ์–ด์ˆ˜์„ ํ•ด ๋ณด์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š” ์—†๋Š” ๊ณต๋ฐฑ์€ ์ค„์ด๋Š” ํŽธ์ด ๊ฐ€๋…์„ฑ์— ์œ ๋ฆฌํ•ฉ๋‹ˆ๋‹ค.


14-18: kakaoSignIn ํ•จ์ˆ˜
์นด์นด์˜ค ๋กœ๊ทธ์ธ ์š”์ฒญ ํ˜•ํƒœ์™€ signIn ํ•จ์ˆ˜ ๋กœ์ง์ด ์œ ์‚ฌํ•˜๊ฒŒ ๊ตฌ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ณตํ†ต ๋กœ์ง์„ ํ•ฉ์น˜๋Š” ๋ฐฉ๋ฒ•๋„ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ํ˜„์žฌ ํ˜•ํƒœ๋„ ๋ช…ํ™•ํ•ด ์œ ์ง€๋ณด์ˆ˜ํ•˜๊ธฐ ์šฉ์ดํ•ฉ๋‹ˆ๋‹ค.


26-31: signUp ํ•จ์ˆ˜
๊ณ„์ • ์ƒ์„ฑ ์š”์ฒญ์ด POST๋กœ ์ž˜ ์„ค์ •๋˜์—ˆ์œผ๋ฉฐ Content-Type๋„ JSON์œผ๋กœ ์ง€์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ถ”ํ›„ ํšŒ์›๊ฐ€์ž… ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ์ค‘๋ณต ์ด๋ฉ”์ผ ์ฒ˜๋ฆฌ ๋“ฑ์˜ ์ƒํ™ฉ์„ ์ฃผ์˜ ๊นŠ๊ฒŒ ํ…Œ์ŠคํŠธํ•ด ๋ณด์„ธ์š”.

client/src/utils/apis/token.ts (3)

12-19: JWT ์ง๋ ฌํ™” ๋กœ์ง
btoa(JSON.stringify(...))๋ฅผ ํ†ตํ•ด ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •์ด ๊ฐ„๋‹จ๋ช…๋ฃŒํ•ฉ๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๋กœ๊น… ์‹œ ๋ฏผ๊ฐ ๋ฐ์ดํ„ฐ๊ฐ€ ๋…ธ์ถœ๋˜์ง€ ์•Š๋„๋ก ์ฃผ์˜๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


24-27: storeToLocalStorage ์‚ฌ์šฉ
ํ™˜๊ฒฝ์— ๋”ฐ๋ผ ์„ธ์…˜ ์Šคํ† ๋ฆฌ์ง€ ๋“ฑ์˜ ์„ ํƒ๋„ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ˜„ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ๋กœ์ง์€ ๊ฐ„๋‹จํ•ด ๋ณด์ด์ง€๋งŒ, ๋ณด์•ˆ ๊ด€์ ์—์„  ํ† ํฐ ํƒˆ์ทจ ์œ„ํ—˜์ด ์žˆ์Œ์„ ์ธ์ง€ํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.


28-36: fromString ์—๋Ÿฌ ์ฒ˜๋ฆฌ
JWT ํŒŒ์‹ฑ์— ์‹คํŒจํ•˜๋ฉด null์„ ๋ฐ˜ํ™˜ํ•˜์—ฌ ์ƒ์œ„ ๋กœ์ง์—์„œ ๋ถ„๊ธฐ ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค. ํ•„์š”ํ•˜๋‹ค๋ฉด ๊ตฌ์ฒด์ ์ธ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด ์—๋Ÿฌ ์›์ธ๋„ ํ•จ๊ป˜ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

client/src/pages/index.tsx (1)

38-46: ๋กœ๊ทธ์ธ ๋กœ์ง ๊ฐœ์„ 

JWT ํ† ํฐ ์ฒ˜๋ฆฌ์™€ ์ €์žฅ์ด ๋” ์•ˆ์ „ํ•˜๊ณ  ์ฒด๊ณ„์ ์œผ๋กœ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ํ† ํฐ ๊ฒ€์ฆ ๊ณผ์ •์ด ์ถ”๊ฐ€๋˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ† ํฐ ๊ฒ€์ฆ ๋กœ์ง์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

  let { accessToken } = await signIn({ email, password });
  let token = Jwt.fromString(accessToken)!;

+ if (!token.isValid()) {
+   throw new Error('Invalid token received');
+ }

  debugPrint("accessToken:", accessToken);

  token.storeToLocalStorage();
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 49fb583 and 189173c.

๐Ÿ“’ Files selected for processing (8)
  • client/src/pages/index.tsx (2 hunks)
  • client/src/pages/signup/index.tsx (2 hunks)
  • client/src/utils/apis/accounts.ts (1 hunks)
  • client/src/utils/apis/common.ts (1 hunks)
  • client/src/utils/apis/token.ts (1 hunks)
  • client/src/utils/debug.ts (0 hunks)
  • client/tsconfig.json (1 hunks)
  • server/src/utils/debug.ts (0 hunks)
๐Ÿ’ค Files with no reviewable changes (2)
  • server/src/utils/debug.ts
  • client/src/utils/debug.ts
๐Ÿ”‡ Additional comments (14)
client/src/utils/apis/common.ts (4)

6-21: HttpException ํด๋ž˜์Šค ๊ตฌํ˜„ ํ™•์ธ
์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ณ  ๋ช…ํ™•ํ•˜๊ฒŒ ํ‘œํ˜„ํ•˜๊ณ  ์žˆ์–ด ์œ ์ง€๋ณด์ˆ˜์— ์œ ๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ์ถ”ํ›„ ๋‹ค์–‘ํ•œ ์—๋Ÿฌ ๋กœ๊น… ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด ๋กœ๊น… ์ธํ„ฐํŽ˜์ด์Šค ์ถ”๊ฐ€๋„ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


53-78: ApiBuilder ๊ธฐ๋ณธ ์˜ต์…˜ ๊ตฌ์„ฑ ์ ๊ฒ€
private ํ•„๋“œ๋กœ URL, method, headers๋ฅผ ๊น”๋”ํ•˜๊ฒŒ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ์œผ๋ฉฐ, ๋ฉ”์„œ๋“œ ์ฒด์ด๋‹ ๊ตฌ์กฐ๊ฐ€ ์ง๊ด€์ ์ž…๋‹ˆ๋‹ค. ๋‹ค๋งŒ ์š”์ฒญ์ด ๋งŽ์•„์งˆ ๊ฒฝ์šฐ๋ฅผ ๋Œ€๋น„ํ•ด, ๊ณตํ†ต ํ—ค๋”(์˜ˆ: JSON ๋“ฑ)๋ฅผ ์ž๋™ ์„ค์ •ํ•˜๋Š” ์œ ํ‹ธ๋ฆฌํ‹ฐ ์ถ”๊ฐ€๋„ ๊ฒ€ํ†  ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.


79-89: commit ๋ฐ commitWithParams ์„ค๊ณ„
์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ๊ณตํ†ต ๋กœ์ง์„ ๋‚ด๋ถ€ static ๋ฉ”์„œ๋“œ๋กœ ๋ถ„๋ฆฌํ•ด ์žฌ์‚ฌ์šฉ์ด ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ์™€ ์•„๋‹Œ ๊ฒฝ์šฐ๋ฅผ ๋ถ„๋ฆฌํ•˜๋Š” ์•„์ด๋””์–ด๊ฐ€ ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค.


215-229: ApiBuilder2 ํด๋ž˜์Šค์˜ ์šฉ๋„ ๋ถˆ๋ช…ํ™•
ApiBuilder์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ ๊ธฐ๋Šฅ์ด ์ œํ•œ์ ์ด์–ด์„œ ์‹ค์ œ ์‚ฌ์šฉ ์‚ฌ๋ก€๊ฐ€ ๋ช…ํ™•ํ•˜์ง€ ์•Š์•„ ๋ณด์ž…๋‹ˆ๋‹ค. ํ•„์š”ํ•˜๋‹ค๋ฉด ApiBuilder์™€ ํ†ตํ•ฉํ•˜๊ฑฐ๋‚˜, ์‹ค์‚ฌ์šฉ ์‹œ ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋กœ์ง์„ ์ •๋น„ํ•ด ๋ณด์„ธ์š”.

client/src/utils/apis/accounts.ts (4)

4-5: ์š”์ฒญ/์‘๋‹ต DTO ์ •์˜
ํƒ€์ž…์œผ๋กœ DTO๋ฅผ ๊ตฌ์กฐํ™”ํ•ด ์ฝ”๋“œ ๊ฐ€๋…์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ์ข‹์•„์กŒ์Šต๋‹ˆ๋‹ค. ๊ฐ ํ•„๋“œ๊ฐ€ ํ•„์ˆ˜/์˜ต์…˜์ธ์ง€ ๋ช…ํ™•ํžˆ ๋“œ๋Ÿฌ๋‚˜ ์ข‹์Šต๋‹ˆ๋‹ค.


6-10: signIn ํ•จ์ˆ˜ - API ๊ฒฝ๋กœ์™€ ์„ค์ •
"accounts/signin"์œผ๋กœ POST ํ˜ธ์ถœ์„ ์ˆ˜ํ–‰ํ•˜๊ณ , JSON Content-Type ์ง€์ •์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค. ์—๋Ÿฌ ์ฒ˜๋ฆฌ ์‹œ ๋‚ด๋ถ€์ ์œผ๋กœ Custom Exception์ด ๋˜์ ธ์ง€๋ฏ€๋กœ, ํ˜ธ์ถœ ์ชฝ์—์„œ ์˜ˆ์™ธ ํ•ธ๋“ค๋ง ๋กœ์ง์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


12-13: KakaoSignInReqDto, KakaoSignInResDto ์ •์˜
์นด์นด์˜ค ์ธ์ฆ์ด ๊ธฐ์กด SignInResDto ํƒ€์ž…์„ ์žฌํ™œ์šฉํ•ด ๋ฐ˜ํ™˜ ํ˜•์‹ ์œ ์ง€๊ฐ€ ๊ฐ„๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ํ•„์š” ์‹œ ์นด์นด์˜ค ํŠนํ™” ํ•„๋“œ๊ฐ€ ์ถ”๊ฐ€๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ํ™•์žฅ ๊ฐ€๋Šฅ์„ฑ์„ ์—ผ๋‘์— ๋‘๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.


20-25: SignUpReqDto ๊ตฌ์กฐ
Optional ํ•„๋“œ(profileUrl)๋ฅผ ๋ช…ํ™•ํžˆ ํ‘œ์‹œํ•ด์ค˜์„œ ์ข‹์Šต๋‹ˆ๋‹ค. ์ด ํ•„๋“œ๊ฐ€ nullableํ•œ์ง€, ๋นˆ ๋ฌธ์ž์—ด์ธ์ง€์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๋Š” ์‚ฌ์šฉํ•˜๋Š” ์ชฝ์—์„œ ์ฃผ์˜๊ฐ€ ํ•„์š”ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

client/src/utils/apis/token.ts (3)

1-2: debugPrint ์ž„ํฌํŠธ
๋””๋ฒ„๊ทธ์šฉ ์ถœ๋ ฅ์ด ์ž˜ ๋ถ„๋ฆฌ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ๋Š” ๋ฏผ๊ฐ ์ •๋ณด๊ฐ€ ๋…ธ์ถœ๋˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•ด ์ฃผ์„ธ์š”.


3-11: Jwt ํด๋ž˜์Šค ๊ตฌ์กฐ
LS_KEY ์ƒ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ด ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ํ‚ค๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ๊ด€๋ฆฌ๋˜๊ณ , JWT ํ—ค๋”, ํŽ˜์ด๋กœ๋“œ, ์„œ๋ช…์„ ๋ถ„ํ• ํ•˜์—ฌ ๋ณด๊ด€ํ•˜๋Š” ๊ตฌ์กฐ๊ฐ€ ๊ธฐ๋Šฅ์ ์œผ๋กœ ๊น”๋”ํ•ฉ๋‹ˆ๋‹ค.


38-47: fromLocalStorage ๋ฉ”์„œ๋“œ
ํ† ํฐ์ด ์—†์„ ๋•Œ debugPrint๋ฅผ ํ†ตํ•ด ์‚ฌ์œ ๋ฅผ ์ฝ˜์†”์— ๋‚จ๊ธฐ๋Š” ๋ฐฉ์‹์ด ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ถ”ํ›„ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„  ๋ฏผ๊ฐ ์ •๋ณด ๋…ธ์ถœ ์œ„ํ—˜์ด ์—†๋„๋ก ์กฐ์ •ํ•ด ์ฃผ์„ธ์š”.

client/src/pages/index.tsx (1)

4-7: API ํ˜ธ์ถœ ๋ฐ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ์œ ํ‹ธ๋ฆฌํ‹ฐ ์ถ”๊ฐ€

์ƒˆ๋กœ์šด ์œ ํ‹ธ๋ฆฌํ‹ฐ๋“ค์„ ํ†ตํ•ด API ํ˜ธ์ถœ๊ณผ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ๋” ์ฒด๊ณ„์ ์œผ๋กœ ๊ตฌ์กฐํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

client/src/pages/signup/index.tsx (1)

5-7: ํšŒ์›๊ฐ€์ž… API ์œ ํ‹ธ๋ฆฌํ‹ฐ ์ถ”๊ฐ€

API ํ˜ธ์ถœ๊ณผ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ์œ ํ‹ธ๋ฆฌํ‹ฐ๊ฐ€ ์ ์ ˆํžˆ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

client/tsconfig.json (1)

12-12:

โ“ Verification inconclusive

๋ชจ๋“ˆ ํ•ด๊ฒฐ ์ „๋žต ๋ณ€๊ฒฝ ๊ฒ€ํ†  ํ•„์š”

moduleResolution์„ "node10"์œผ๋กœ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์ด ํ”„๋กœ์ ํŠธ์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ์›น ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ์ด ๋ณ€๊ฒฝ์˜ ์˜ํ–ฅ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”:


๐ŸŒ Web query:

What are the implications of changing TypeScript moduleResolution to "node10"?

๐Ÿ’ก Result:

Changing TypeScript's moduleResolution to "node10" has several implications tied to outdated Node.js compatibility and modern ecosystem limitations:

Key Implications

  1. CommonJS-Only Resolution
    node10 mimics Node.js <v10 environments, which only support CommonJS require-style imports[1][9]. It lacks native ECMAScript module (ESM) import/export resolution algorithms used in Node.js โ‰ฅv12[1][5].

  2. No Package.json "exports" Support
    Unlike modern resolutions (node16, nodenext, bundler), node10 ignores package.json exports maps[4][7]. Subpath imports like import 'pkg/subpath' will fail unless packages provide explicit legacy directory listings[4].

  3. File Extension Requirements
    Imports must include full file extensions (.js, .ts) for relative/absolute paths[1][7], unlike bundler mode which allows extensionless imports[1].

  4. Deprecated Naming Confusion
    Previously called "node", this option was renamed to "node10" for clarity[6][9]. Projects using older TS versions might still see references to the original name.

When You Might Use It

  • Maintaining codebases targeting Node.js โ‰คv9 (EOL since 2019)
  • Working with dependencies that haven't adopted package.json exports[4]
  • Debugging legacy systems where upgrading dependencies/modern resolution isn't feasible

Modern Alternatives

Strategy Best For Key Features
nodenext Node.js โ‰ฅv12 Full ESM/CJS hybrid resolution[1][3]
bundler Webpack/Rollup/Vite Relaxed extension rules + exports support[1][5]
node16 TypeScript 5.3+ Explicit Node.js ESM semantics[1][3]

Most projects should migrate to bundler or nodenext unless explicitly maintaining legacy environments[1][5][7]. The --moduleResolution node10 flag primarily exists for backward compatibility rather than new development[9].

Citations:


๋ชจ๋“ˆ ํ•ด๊ฒฐ ์ „๋žต ์˜ํ–ฅ ์žฌ๊ฒ€ํ†  ์š”์ฒญ

ํ˜„์žฌ client/tsconfig.json ํŒŒ์ผ์—์„œ "moduleResolution": "node10"์œผ๋กœ ์„ค์ •ํ•œ ๋ณ€๊ฒฝ์€ ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  • CommonJS ์ „์šฉ ํ•ด์„:
    node10์€ Node.js v10 ๋ฏธ๋งŒ์˜ ํ™˜๊ฒฝ์„ ๋ชจ๋ฐฉํ•˜์—ฌ CommonJS ์ „์šฉ ํ•ด์„ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ตœ์‹  ESM(import/export) ์ง€์›์ด ํ•„์š”ํ•œ ํ™˜๊ฒฝ์—์„œ๋Š” ํ˜ธํ™˜์„ฑ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • package.json์˜ exports ๋ฏธ์ง€์›:
    ์ตœ์‹  ๋ชจ๋“ˆ ํ•ด์„ ์˜ต์…˜(node16, nodenext, bundler)๊ณผ ๋‹ฌ๋ฆฌ, "node10"์€ package.json ๋‚ด์˜ "exports" ํ•„๋“œ๋ฅผ ๋ฌด์‹œํ•ฉ๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ํ•˜์œ„ ๊ฒฝ๋กœ(import 'pkg/subpath') ์‚ฌ์šฉ ์‹œ ๋ฌธ์ œ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ํŒŒ์ผ ํ™•์žฅ์ž ์š”๊ตฌ ์ฆ๊ฐ€:
    ์ƒ๋Œ€/์ ˆ๋Œ€ ๊ฒฝ๋กœ์˜ ๋ชจ๋“ˆ ์ž„ํฌํŠธ ์‹œ ํŒŒ์ผ์˜ ํ™•์žฅ์ž(.js, .ts)๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ํฌํ•จํ•ด์•ผ ํ•˜๋Š” ์ œํ•œ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ, ํ”„๋กœ์ ํŠธ์˜ ๋ชจ๋“ˆ ํ•ด์„ ์ „๋žต์ด ์ตœ์‹  Node.js ํ™˜๊ฒฝ์ด๋‚˜ ์™ธ๋ถ€ ํŒจํ‚ค์ง€์™€์˜ ํ˜ธํ™˜์„ฑ์„ ํ•„์š”๋กœ ํ•˜๋Š” ๊ฒฝ์šฐ, node10 ์‚ฌ์šฉ์ด ์ ํ•ฉํ•œ์ง€ ์žฌ๊ฒ€ํ† ํ•˜๊ณ , ํ•„์š”์— ๋”ฐ๋ผ nodenext, bundler ๋˜๋Š” node16 ๋“ฑ ๋‹ค๋ฅธ ์˜ต์…˜์„ ๊ณ ๋ คํ•ด๋ณด์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

Comment on lines +47 to 54
} catch (e) {
if (e instanceof BadRequestException) {
alert('bad request');
} else if (e instanceof NotFoundException) {
alert('no such account');
} else {
console.error('unknown error >', e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์—๋Ÿฌ ์ฒ˜๋ฆฌ ๊ฐœ์„ 

์—๋Ÿฌ ๋ฉ”์‹œ์ง€๊ฐ€ ์‚ฌ์šฉ์ž ์นœํ™”์ ์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋” ์ž์„ธํ•œ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ์ œ๊ณตํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  } catch (e) {
    if (e instanceof BadRequestException) {
-     alert('bad request');
+     alert('์ž…๋ ฅํ•˜์‹  ์ •๋ณด๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด์ฃผ์„ธ์š”.');
    } else if (e instanceof NotFoundException) {
-     alert('no such account');
+     alert('๋“ฑ๋ก๋˜์ง€ ์•Š์€ ๊ณ„์ •์ž…๋‹ˆ๋‹ค. ํšŒ์›๊ฐ€์ž…์„ ์ง„ํ–‰ํ•ด์ฃผ์„ธ์š”.');
    } else {
      console.error('unknown error >', e);
+     alert('๋กœ๊ทธ์ธ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.');
    }
  }
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (e) {
if (e instanceof BadRequestException) {
alert('bad request');
} else if (e instanceof NotFoundException) {
alert('no such account');
} else {
console.error('unknown error >', e);
}
} catch (e) {
if (e instanceof BadRequestException) {
alert('์ž…๋ ฅํ•˜์‹  ์ •๋ณด๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด์ฃผ์„ธ์š”.');
} else if (e instanceof NotFoundException) {
alert('๋“ฑ๋ก๋˜์ง€ ์•Š์€ ๊ณ„์ •์ž…๋‹ˆ๋‹ค. ํšŒ์›๊ฐ€์ž…์„ ์ง„ํ–‰ํ•ด์ฃผ์„ธ์š”.');
} else {
console.error('unknown error >', e);
alert('๋กœ๊ทธ์ธ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.');
}

Comment on lines 33 to 44
const handleSignupClick = async () => {
const url = `${process.env.NEXT_PUBLIC_BASE_URL}/api/v1/accounts/signup`;
console.log(url);

try {
await axios.post(
url!,
{
email,
nickname,
password,
profileUrl,
},
{
headers: {
"Content-Type": "application/json"
}
}
);
let { id: uid } = await signUp({ email, nickname, password, profileUrl });
debugPrint('uid:', uid);

router.push('/');
} catch(e) {
if (axios.isAxiosError(e)) {
if (e.response?.status === 400) {
alert('bad request');
} else {
alert('unknown error');
}
} catch (e) {
if (e instanceof BadRequestException) {
alert('bad request');
} else {
console.error('unknown error >', e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

ํšŒ์›๊ฐ€์ž… ๋กœ์ง ๋ฐ ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๊ฐœ์„  ํ•„์š”

ํšŒ์›๊ฐ€์ž… ์„ฑ๊ณต ์‹œ ์‚ฌ์šฉ์ž ํ”ผ๋“œ๋ฐฑ์ด ์—†์œผ๋ฉฐ, ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๊ฐ€ ๋ถˆ์นœ์ ˆํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ์ž…๋ ฅ๊ฐ’ ๊ฒ€์ฆ์ด ๋ถ€์กฑํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  const handleSignupClick = async () => {
+   if (password.length < 8) {
+     alert('๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 8์ž ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.');
+     return;
+   }
    try {
      let { id: uid } = await signUp({ email, nickname, password, profileUrl });
      debugPrint('uid:', uid);

+     alert('ํšŒ์›๊ฐ€์ž…์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.');
      router.push('/');
    } catch (e) {
      if (e instanceof BadRequestException) {
-       alert('bad request');
+       alert('์ž…๋ ฅํ•˜์‹  ์ •๋ณด๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด์ฃผ์„ธ์š”. ์ด๋ฉ”์ผ ํ˜•์‹์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธํ•ด์ฃผ์„ธ์š”.');
      } else {
        console.error('unknown error >', e);
+       alert('ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.');
      }
    }
  };
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSignupClick = async () => {
const url = `${process.env.NEXT_PUBLIC_BASE_URL}/api/v1/accounts/signup`;
console.log(url);
try {
await axios.post(
url!,
{
email,
nickname,
password,
profileUrl,
},
{
headers: {
"Content-Type": "application/json"
}
}
);
let { id: uid } = await signUp({ email, nickname, password, profileUrl });
debugPrint('uid:', uid);
router.push('/');
} catch(e) {
if (axios.isAxiosError(e)) {
if (e.response?.status === 400) {
alert('bad request');
} else {
alert('unknown error');
}
} catch (e) {
if (e instanceof BadRequestException) {
alert('bad request');
} else {
console.error('unknown error >', e);
}
const handleSignupClick = async () => {
if (password.length < 8) {
alert('๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 8์ž ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.');
return;
}
try {
let { id: uid } = await signUp({ email, nickname, password, profileUrl });
debugPrint('uid:', uid);
alert('ํšŒ์›๊ฐ€์ž…์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.');
router.push('/');
} catch (e) {
if (e instanceof BadRequestException) {
alert('์ž…๋ ฅํ•˜์‹  ์ •๋ณด๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด์ฃผ์„ธ์š”. ์ด๋ฉ”์ผ ํ˜•์‹์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธํ•ด์ฃผ์„ธ์š”.');
} else {
console.error('unknown error >', e);
alert('ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.');
}
}
};

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.

1 participant