/* ── Halaman Login ── */ function LoginPage({ navigate, onLogin }) { const [email, setEmail] = useState(''); const [pass, setPass] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const submit = async (e) => { e.preventDefault(); setError(''); setLoading(true); try { const res = await api.post('auth.php?action=login', { email, password: pass }); if (res.ok && res.user) onLogin(res.user); else setError(res.error || 'Login gagal.'); } catch { setError('Tidak dapat terhubung ke server.'); } finally { setLoading(false); } }; return (
Panel Dashboard
Markaz Qurrota A'yun
setEmail(e.target.value)} required placeholder="admin@qurrotaayun.com" style={{ width: '100%', padding: '12px 14px', borderRadius: 10, border: '1.5px solid var(--border)', fontSize: 14, fontFamily: 'inherit' }} />
setPass(e.target.value)} required placeholder="••••••••" style={{ width: '100%', padding: '12px 14px', borderRadius: 10, border: '1.5px solid var(--border)', fontSize: 14, fontFamily: 'inherit' }} />
{error &&
{error}
}
{api.mode === 'mock' && /localhost|127\.0\.0\.1/.test(location.hostname) && (
Mode Preview (data tiruan):
admin@qurrotaayun.com / admin123
penulis@qurrotaayun.com / penulis123
)}
); } window.LoginPage = LoginPage;