/** * 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 (

Xpeditis

Sign in to your account

Or{' '} create a new account

{error && (
{error}
)}
setEmail(e.target.value)} className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" placeholder="Email address" />
setPassword(e.target.value)} className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" placeholder="Password" />
Forgot your password?
); }