[5주차/엘리] 워크북 제출합니다.#50
Open
seohyeon0219 wants to merge 6 commits intoUMC-Inha:엘리/mainfrom
Hidden character warning
The head ref may contain hidden characters: "\uc5d8\ub9ac/main"
Open
Conversation
12234538
reviewed
May 2, 2026
jjeunv
reviewed
May 3, 2026
haewonwon
reviewed
May 4, 2026
Comment on lines
+53
to
+67
| try { | ||
| setServerError('') | ||
| const response = await api.post<{ name: string; accessToken: string; refreshToken: string }>( | ||
| '/v1/auth/signup', | ||
| { name: data.nickname, email: savedEmail, password: savedPassword }, | ||
| ) | ||
| setToken({ | ||
| accessToken: response.data.accessToken, | ||
| refreshToken: response.data.refreshToken, | ||
| name: response.data.name, | ||
| }) | ||
| navigate('/') | ||
| } catch { | ||
| setServerError('회원가입에 실패했습니다. 다시 시도해주세요.') | ||
| } |
There was a problem hiding this comment.
catch에서 에러 객체를 무시하고 있습니다. 서버 응답 에러 메세지를 활용하면 좋을 것 같아요!
// 현재
} catch {
setServerError('회원가입에 실패했습니다. 다시 시도...')
}
// 개선
} catch (error) {
const message = axios.isAxiosError(error)
? error.response?.data?.message
: undefined
setServerError(message ?? '회원가입에 실패했습니다. 다시 시도해주세요.')
}
setServerError('')를 try 안에서 하면, 이전 에러가 잠깐 보일 수 있어서 submit 핸들러 최상단으로 올리는 게 낫습니다!
const handleSignupComplete = nicknameForm.handleSubmit(async (data) => {
setServerError('') // ← try 바깥으로
try {
...
}
})
qkrdmsthff
reviewed
May 4, 2026
Collaborator
qkrdmsthff
left a comment
There was a problem hiding this comment.
LGTM 엘리 이번 주차도 화이팅입니다!
| return api(originalRequest) | ||
| } catch { | ||
| localStorage.removeItem('token') | ||
| window.location.href = '/login' |
Collaborator
There was a problem hiding this comment.
엘리 ~ 코드를 너무 깔끔하게 잘 짜주셔서 드릴 코드 리뷰가 없네요...!
그나마 추가해 보자면,
현재 SPA 의 장점을 무시하고 window.location.href 를 사용해서 페이지를 이동하고 있습니다! react-route-dom 의 useNavigate 훅을 사용해 보는 것을 권장합니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점