'use client'; import { clearExpiredSessionAction, loginAction, LoginResult } from '@/lib/actions/auth'; import { use, useActionState, useEffect } from 'react'; import type { HealthStatus } from '@/lib/api/server/health'; import { Badge } from '@/components/ui/Badge'; const initialState: LoginResult = { message: '', success: true }; export default function LoginForm({ searchParams, health }: { searchParams: Promise<{ expired: boolean | undefined }>; health: HealthStatus; }) { const params = use(searchParams); const expired = params.expired; useEffect(() => { if (expired) { clearExpiredSessionAction(); } }, [expired]); const [state, formAction] = useActionState(loginAction, initialState); return (

ACC Server Manager

Sign in to manage your servers

{health.healthy ? ( API v{health.version} ) : ( API unreachable )}
{expired && (
Your session has expired. Please sign in again.
)} {state?.success ? null : (
{state?.message}
)}
); }