'use client'; import React, { useState } from 'react'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import type { Metadata } from 'next'; // Note: This can't be exported from a client component // The metadata would need to be in a separate layout.tsx file const metadata = { title: 'Admin Login | Olathe Club of the Deaf', description: 'Secure login for Olathe Club of the Deaf administrators', }; const LoginPage = () => { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { // This will be replaced with actual API call in the future // For now, it's just a mock implementation const response = await fetch('/api/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ username, password }), }); if (!response.ok) { const data = await response.json(); throw new Error(data.message || 'Login failed'); } // Login successful, redirect to admin dashboard router.push('/admin/dashboard'); } catch (err) { console.error('Login error:', err); setError(err instanceof Error ? err.message : 'An unknown error occurred'); } finally { setLoading(false); } }; return (

OCD Admin Portal

Secure login for authorized administrators

{error && (
{error}
)}
setUsername(e.target.value)} aria-required="true" />
setPassword(e.target.value)} aria-required="true" />
Forgot your password?
Return to public site
); }; export default LoginPage;