Skip to content
Snippets Groups Projects
Commit 3a7d2a4b authored by pjookim's avatar pjookim
Browse files

refactor: clean up handleLogin function

parent 2f4d1df7
Branches
No related tags found
No related merge requests found
......@@ -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`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment