-
Notifications
You must be signed in to change notification settings - Fork 0
[FE-33] feat: 닉네임 중복 기능 구현 #38
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Seongtaek-H
left a comment
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.
어제 로직보다 이게 훨씬 어려운데요. 한 번 직접 설명해주시면 좋을 것 같습니다.
| export const login = ({ type, token }: IAuth) => { | ||
| return baseInstance.post(`/member/oauth/login/${type}`, { | ||
| oauth_token: token, | ||
| }) | ||
| } | ||
|
|
||
| export const signUp = async ({ type, tempId, nickname }: ISignUp) => { | ||
| return await baseInstance.post(`/member/oauth/register/{${type}`, { | ||
| export const signUp = ({ type, tempId, nickname }: ISignUp) => { | ||
| return baseInstance.post(`/member/oauth/register/{${type}`, { |
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.
async await을 밖으로 빼신거죠? 확인했씁니다
| setIsLoading(true) | ||
| e.preventDefault() | ||
|
|
||
| const newErrors = validate ? validate(values) : {} |
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.
validate 가 없는 경우도 있나여
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.
필수로 validate를 넣으면 좋을 것 같지만 혹시 사용하지 않을 수도 있는 확장성을 위해 넣어두겠습니당! :)
| validate: ({ nickname }) => { | ||
| const error: { nickname?: string } = {} | ||
| const spacePattern = /\s/g | ||
| const nicknamePattern = /^.{2,8}$/ | ||
|
|
||
| if (nickname.match(spacePattern)) { | ||
| error.nickname = '공백을 제거해주세요' | ||
| } | ||
|
|
||
| if (!nickname.match(nicknamePattern)) { | ||
| error.nickname = '국문, 영문, 숫자로 이루어진 2~8자로 입력해주세요' | ||
| } | ||
|
|
||
| return 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.
여긴 그러니까 통과안될때 에러만 리턴하는 로직인거죠?
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.
넵넵 그렇습니다!
src/pages/SignUp/SignUp.tsx
Outdated
| useEffect(() => { | ||
| if (location.state.tempSessionId) { | ||
| const tempId = location.state.tempSessionId | ||
| setUserInfo({ ...userInfo, tempId }) | ||
| if (!location.state.tempSessionId) { | ||
| nativate('/login') |
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.
회원가입 성공을 말하시는걸까요??
현재 로직은 로그인 실패했을 경우에 임시세션아이디를 백엔드에서 준 것을 가져오고있습니다!
react-query/hooks/useAuth파일 보시면 될 것 같아요!
endmoseung
left a comment
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.
코드 잘 봤어요!!!수고하셨습니다 워터
src/pages/SignUp/SignUp.tsx
Outdated
| }) | ||
| const { isSuccess } = useGetDuplicateNickname(nickname, checkedNickname) | ||
|
|
||
| const nativate = useNavigate() |
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.
| const nativate = useNavigate() | |
| const navigate = useNavigate() |
오타수정이용
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.
왕 감사합니다
|
|
||
| if (!nickname.match(nicknamePattern)) { | ||
| error.nickname = '국문, 영문, 숫자로 이루어진 2~8자로 입력해주세요' | ||
| } |
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.
validation 정규직 사용 깔끔합니다
src/pages/SignUp/SignUp.tsx
Outdated
| nickname: '', | ||
| const [nickname, setNickname] = useState('') | ||
| const [checkedNickname, setCheckedNickname] = useState(false) | ||
| const [property, setProperty] = useState<PropertyType>('default') |
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.
| const [property, setProperty] = useState<PropertyType>('default') | |
| const [property, setProperty] = useState<PropertyType>('default') |
boolean값을 반환하는 변수이름은 아래에서 그러셨던덕처럼 is를 붙이는게 더 이해가 편할것 같아용
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.
혹시 checkedNickname을 말하시는걸까요? <- 이부분 반영하겠습니다!
- navigate 함수명 수정 - validate 필수가 아니도록 변경
작업 내용
참고 이미지(선택)
어떤 점을 리뷰 받고 싶으신가요?