'use client'; import { useState } from 'react'; interface Props { onSuccess: () => void; } export default function AdminLogin({ onSuccess }: Props) { const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(''); setLoading(true); try { const res = await fetch('/api/admin/auth', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ password }), }); if (res.ok) { onSuccess(); } else { const data = await res.json(); setError(data.error || 'Login failed'); } } catch { setError('Connection error'); } finally { setLoading(false); } } return (

Immich Folio

Admin Panel

setPassword(e.target.value)} placeholder="Enter admin password" autoFocus disabled={loading} />
{error &&
{error}
}
); }