/** * Login Page * * User login with email and password */ 'use client'; import { useState } from 'react'; import { useAuth } from '@/lib/context/auth-context'; import Link from 'next/link'; export default function LoginPage() { const { login } = useAuth(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { await login(email, password); } catch (err: any) { setError(err.response?.data?.message || 'Login failed. Please check your credentials.'); } finally { setLoading(false); } }; return (
Or{' '} create a new account