Skip to content

Conversation

@sookyeonghwang
Copy link
Member

작업 내용

  • 닉네임 중복 기능 구현(useGetDuplicateNickname 쿼리 훅 구현)
  • useForm 훅 구현
    • handleChange, handleRemove, handleSubmit 으로 폼 관리
    • error 핸들링 적용

참고 이미지(선택)

닉네임 중복 기능 구현

어떤 점을 리뷰 받고 싶으신가요?

  • 오타, 함수명, 변수명 등 로직까지 모두 부탁드립니다 :)

@vercel
Copy link

vercel bot commented Dec 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
recordit ✅ Ready (Inspect) Visit Preview Dec 29, 2022 at 9:13AM (UTC)

Copy link
Member

@Seongtaek-H Seongtaek-H left a comment

Choose a reason for hiding this comment

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

어제 로직보다 이게 훨씬 어려운데요. 한 번 직접 설명해주시면 좋을 것 같습니다.

Comment on lines +4 to +11
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}`, {
Copy link
Member

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) : {}
Copy link
Member

Choose a reason for hiding this comment

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

validate 가 없는 경우도 있나여

Copy link
Member Author

Choose a reason for hiding this comment

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

필수로 validate를 넣으면 좋을 것 같지만 혹시 사용하지 않을 수도 있는 확장성을 위해 넣어두겠습니당! :)

Comment on lines +27 to +41
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
},
Copy link
Member

Choose a reason for hiding this comment

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

여긴 그러니까 통과안될때 에러만 리턴하는 로직인거죠?

Copy link
Member Author

Choose a reason for hiding this comment

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

넵넵 그렇습니다!

Comment on lines 47 to 49
useEffect(() => {
if (location.state.tempSessionId) {
const tempId = location.state.tempSessionId
setUserInfo({ ...userInfo, tempId })
if (!location.state.tempSessionId) {
nativate('/login')
Copy link
Member

Choose a reason for hiding this comment

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

세션아이디 받아오는거 성공했을때 로직은 어디있어요??

Copy link
Member Author

Choose a reason for hiding this comment

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

회원가입 성공을 말하시는걸까요??

현재 로직은 로그인 실패했을 경우에 임시세션아이디를 백엔드에서 준 것을 가져오고있습니다!
react-query/hooks/useAuth파일 보시면 될 것 같아요!

Copy link
Contributor

@endmoseung endmoseung left a comment

Choose a reason for hiding this comment

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

코드 잘 봤어요!!!수고하셨습니다 워터

})
const { isSuccess } = useGetDuplicateNickname(nickname, checkedNickname)

const nativate = useNavigate()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const nativate = useNavigate()
const navigate = useNavigate()

오타수정이용

Copy link
Member Author

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자로 입력해주세요'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

validation 정규직 사용 깔끔합니다

nickname: '',
const [nickname, setNickname] = useState('')
const [checkedNickname, setCheckedNickname] = useState(false)
const [property, setProperty] = useState<PropertyType>('default')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const [property, setProperty] = useState<PropertyType>('default')
const [property, setProperty] = useState<PropertyType>('default')

boolean값을 반환하는 변수이름은 아래에서 그러셨던덕처럼 is를 붙이는게 더 이해가 편할것 같아용

Copy link
Member Author

Choose a reason for hiding this comment

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

혹시 checkedNickname을 말하시는걸까요? <- 이부분 반영하겠습니다!

- navigate 함수명 수정
- validate 필수가 아니도록 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants