From 7a8b0d6b804375154d4b85efa90d589766ec2b26 Mon Sep 17 00:00:00 2001 From: JH-anfseo <51734656+JH-anfseo@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:04:26 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=9C=A0?= =?UTF-8?q?=ED=9A=A8=EC=84=B1=EC=B6=94=EA=B0=80,=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Hooks/useLogin.js | 8 ++++---- src/screen/LoginPage.jsx | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Hooks/useLogin.js b/src/Hooks/useLogin.js index 8298dd3..793939c 100644 --- a/src/Hooks/useLogin.js +++ b/src/Hooks/useLogin.js @@ -7,9 +7,8 @@ export const SignIn = async (payload) => { const { email, password } = payload; Keyboard.dismiss(); // 버튼 클릭 시 키보드 접기 return signInWithEmailAndPassword(auth, email, password); - //navigate('Tabs', { screen: '메인 페이지' }) }; -export const useSignIn = () => { +export const useSignIn = (navigate) => { return useMutation(SignIn, { onError: (err) => { if (err.message.includes('user-not-found')) { @@ -19,8 +18,9 @@ export const useSignIn = () => { alert('비밀번호가 틀렸습니다.'); } }, - onSuccess: ({ navigate }) => { - //navigate('Tabs', { screen: '메인 페이지' }); + onSuccess: () => { + //네비게이션 메인페이지 이동 + navigate('Tabs', { screen: '메인 페이지' }); }, }); }; diff --git a/src/screen/LoginPage.jsx b/src/screen/LoginPage.jsx index 0ca90ee..9bb2656 100644 --- a/src/screen/LoginPage.jsx +++ b/src/screen/LoginPage.jsx @@ -25,7 +25,7 @@ const LoginPage = ({ navigation: { navigate } }) => { const matchedEmail = email.match(regex.email); const matchedPw = password.match(regex.password); - const { onSuccess, mutate: SignIn } = useSignIn(); + const { mutate: SignIn } = useSignIn(navigate); //이메일이나 비밀번호가 빈칸이면 alert출력 const handleLogin = (email, password) => { @@ -48,7 +48,6 @@ const LoginPage = ({ navigation: { navigate } }) => { SignIn({ email, password, navigate }); setEmail(''); setpassword(''); - navigate('Tabs', { screen: '메인 페이지' }); } };