diff --git a/src/pages/Login.js b/src/pages/Login.js index 23bc4e4596c11bfd92538ca7684e27488b6f9fc8..1cc13550686809c527399737278fe0e2e6a52b8f 100644 --- a/src/pages/Login.js +++ b/src/pages/Login.js @@ -18,25 +18,6 @@ function Login() { const toast = useToast(); - //세션 로그인------------------------- - // useEffect(() => { - // const params = new URLSearchParams(window.location.search); - // const userParam = params.get('user'); - - // if (userParam) { - // try { - // const userData = JSON.parse(decodeURIComponent(userParam)); - // login(userData); - // toast.success('구글 로그인에 성공했습니다.'); - // navigate('/'); - // } catch (error) { - // console.error('구글 로그인 처리 중 오류 발생:', error); - // toast.error('구글 로그인 중 오류가 발생했습니다.'); - // } - // } - // }, [navigate, login, toast]); - - //jwt 후 로그인------------------------- useEffect(() => { const params = new URLSearchParams(window.location.hash.substring(1)); const tokenParam = params.get('token'); @@ -59,40 +40,6 @@ function Login() { navigate('/'); } }, [navigate, login, toast]); - - - //세션 로그인------------------------- - // const handleLogin = async (e) => { - // e.preventDefault(); - // setLoading(true); - - // try { - // const response = await axios.post('http://localhost:8000/login', { - // email: username, - // password: password - // }); - - // if (response.status === 200) { - // const userData = response.data.user; - // login(userData); - // console.log(userData); - // toast.success('로그인에 성공했습니다.'); - // navigate('/'); - // } - // } catch (error) { - // if (error.response) { - // toast.error(error.response.data.message); - // } else { - // toast.error('로그인 중 오류가 발생했습니다.'); - // } - // console.error('Login error:', error); - // } finally { - // setLoading(false); - // } - // }; - - //jwt 후 로그인------------------------- - // handleLogin 함수만 수정 const handleLogin = async (e) => { e.preventDefault(); setLoading(true); @@ -138,7 +85,6 @@ const handleLogin = async (e) => { setLoading(false); } }; - //jwt 후 로그인------------------------- const handleGoogleLogin = () => { window.location.href = `${API_URL}/googlelogin`;