-
Notifications
You must be signed in to change notification settings - Fork 1
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
issue#78 이메일 전송 및 인증번호 검증 #79
Conversation
아직 코드를 보진 않았는데 해당 에러는 input 렌더링 관련 에러입니다. 구글링하면 여러 케이스 나오니까 원인을 찾고 한번 해결해보세용 |
- 유저아이디 값 props로 넘겨받기 - 에러 코드 서버 반환값으로 보여주기 - 정상 동작 확인하기
- 초기 값에 빈 값을 넣어 오류 수정
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setMessage(message) | ||
} | ||
|
||
const onError = (error: Error) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(🚨 이거 먼저 해결해주세요)
서버에서 반한되는 에러 타입과 프론트에서 처리하는 에러 타입이 다르게 생긴 거 같아요. swagger와 Network에서 실제로 반환되는 에러 타입을 확인하고, 아래의 에러 파싱을 수정해주세용
추가로 field가 email, code, userid일 때, 인증번호 field에서 에러 메세지를 보여주고 싶은 건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스웨거에 정의된 에러 타입이 많이 없어서 직접 하나씩 필드 비워보고 확인해서 추가해보았는데, 어떤식으로 에러타입이 다른지 알수있나요??
인증번호 field에 필요한 값이 userId, email, code 라서 인증번호 field에서 에러메세지를 보여주고 싶었던게 맞습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아.. 400에러가 다음과 같이 2가지의 형식으로 반환되어서 아래의 형식이 파싱되지 않아서 안보였던 거 같아요! 이건 백엔드 측에 수정을 요청 해야할 것 같네용 프론트는 코드 수정 없어도 될 거 같아욤
{
"code": "COMMON_001",
"message": "Parameter is invalid.",
"errors": [
{
"field": "code",
"message": "인증 코드 형식이 맞지 않습니다."
}
]
}
{"code":"EMAIL_001","message":"인증 코드가 만료되었거나 일치하지 않습니다."}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스웨거에 정의된 에러 타입이 많이 없어서 직접 하나씩 필드 비워보고 확인해서 추가해보았는데, 어떤식으로 에러타입이 다른지 알수있나요??
에러 타입은 백엔드와 약속이어서 따로 확인할 방법은 소통,, 밖에 없는 거 같아요. 저는 의도적으로 이상한 값을 넣어서 테스트를 많이 해보는 편입니당 저희 프로젝트에서는 일반적으로 {"code": "code1","message":"에러 메세지."}
타입을 사용하고, 회원가입처럼 여러 필드에서 input 유효성 검사를 할 땐 아래의 형식처럼 에러를 반환합니다,
{
"code": "code",
"message": "message.",
"errors": [
{
"field": "field명",
"message": "에러 메세지."
}
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dobbymin
프론트에서 Input 유효성 검사 할 때는 1번에 사용되는 에러를 참고해서 추가하면 될 거 같고,
api에 따라 달라지는 에러는 swagger를 참고해서 에러 메세지를 보여주거나 액션을 추가하면 될 거 같아요.
결론적으로 백엔드 추가 수정은 없고, 400 에러 중 code EMAIL_001 인 에러일 때, 파싱해서 처리하는 거 추가하면 될 거 같습니당
- input 자체에 대한 유효성 검사 후 반환되는 에러(/src/models/data-contracts.ts 에서 확인 가능)
{
"code": "COMMON_001",
"message": "Parameter is invalid.",
"errors": [
{
"field": "code",
"message": "인증 코드 형식이 맞지 않습니다."
}
]
}
- 로직 검사 후 반환되는 에러(swagge에서 확인 가능)
{"code":"EMAIL_001","message":"인증 코드가 만료되었거나 일치하지 않습니다."}
고생 많으셨습니다 해당 이슈도 머지하겠습니당 |
📝 상세 내용
#️⃣ 이슈 번호
🔗 참고 자료
📷 스크린샷(선택)