'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { useAuthStore } from '@/lib/auth'; export default function LoginPage() { const router = useRouter(); const login = useAuthStore((s) => s.login); 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); router.push('/'); } catch (err: any) { setError(err.response?.data?.error || 'Invalid credentials'); } finally { setLoading(false); } }; return (
Platform Administration