import { useState } from 'react'; import { useNavigate, Link, useLocation } from 'react-router-dom'; import { useAuth } from '../context/useAuth'; import { getSSAFYLoginURL } from '../api/auth'; import './AuthPage.css'; export default function LoginPage() { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const { login } = useAuth(); const navigate = useNavigate(); const location = useLocation(); const justRegistered = location.state?.registered; const handleSubmit = async (e) => { e.preventDefault(); setError(''); if (!username.trim() || !password) { setError('아이디와 비밀번호를 입력해주세요.'); return; } setLoading(true); try { await login(username, password); navigate('/', { replace: true }); } catch (err) { setError(err.message || '로그인에 실패했습니다.'); } finally { setLoading(false); } }; return (
MULTIPLAYER