-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: 회원가입 구현 #1 #4 #11
Conversation
firebase와 연동하여 회원가입 기능 구현했습니다. 유효성 검사까지 완료했습니다.
src/Hooks/useAuth.js
Outdated
export const handleSignUp = async (email, password) => { | ||
Keyboard.dismiss(); // 버튼 클릭 시 키보드 접기 | ||
return createUserWithEmailAndPassword(auth, email, password); | ||
// .then() | ||
// .catch((error) => { | ||
// if (error.message.includes('email-already-in-use')) { | ||
// alert( | ||
// '이미 가입된 이메일입니다. 로그인을 시도하거나 다른 이메일을 사용해 주세요.', | ||
// ); | ||
// } | ||
// console.log(error); | ||
// }); | ||
}; | ||
useMutation(() => handleSignUp(email, password)); |
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 getUID = () => {
return getAuth();
};
const { data: uid } = useQuery('uid', getUID, {
select: (data) => {
return data?.currentUser?.uid;
},
});
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.
uid 쿼리를 접근할 수 있어야 합니다.
const [email, setEmail] = useState(''); // 이메일 값 저장 | ||
const [password, setPassword] = useState(''); // 비밀번호 값 저장 | ||
const [correctEmail, setCorrectEmail] = useState(true); // 이메일 유효성 검사 | ||
const [correctPassword, setCorrectPassword] = useState(true); // 비밀번호 유효성 검사 | ||
const [visablePassword, setVisablePassword] = useState(false); // 비밀번호 보이게 |
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 useInput = () => {
const [inputValue, setInputValue] = useState("")
const reset = () => {
setInputValue("")
}
return {inputValue, setInputValue, reset}
}
const {inputValeu: email, } = useInput()
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.
이분은 반영 안 해도 괜찮습니다.
useUID 커스텀 훅 생성
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.
TL; DR
firebase와 연동하여 회원가입 기능 구현했습니다. 유효성 검사까지 완료했습니다.