import { useActionState } from 'react'; import { errorText } from '@/client/radio/api.ts'; export function Login({ onLogin }: { onLogin: (password: string) => Promise }) { const [error, submit, pending] = useActionState(async (_previous: string, form: FormData) => { try { await onLogin(String(form.get('password') ?? '')); return ''; } catch (error) { return errorText(error); } }, ''); return (
Private access

Enter the password to listen and use the controls.

{error ? (

{error}

) : null}
); }