-
Notifications
You must be signed in to change notification settings - Fork 4
마이페이지 api 추가 #195
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
base: develop
Are you sure you want to change the base?
마이페이지 api 추가 #195
Conversation
//이메일 중복 확인 | ||
export const getUserEmailCheck = async (email) => { | ||
const { data } = await axios.get(`${baseUrl}/emailCheck?email=${email}`); | ||
if(data === true){ | ||
alert('중복된 이메일입니다!') | ||
} | ||
else{ | ||
return data; | ||
} | ||
}; |
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
의 useQuery
에서 query function
은 api 요청해서 받은 data
를 반환을 해야 해서 다른 함수들처럼 바로 data
를 반환해야 할 거예요. if
문 안 로직의 경우에는 useQuery
에서 onSuccess
를 이용하면 되서 로직을 함수 밖으로 옮기셔야 할 거 같아요!
src/lib/api/user.js
Outdated
onSuccess: () => { | ||
if(data === false){ | ||
return data; | ||
} |
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.
onSuccess
는 useQuery
함수 인자로 들어가는 거라서 이렇게 작성하시면 에러가 날거예요. return data
로 코드 수정해주세요!
Uh oh!
There was an error while loading. Please reload this page.