import { useState } from "preact/hooks" import { login } from "../lib/api" export function LoginForm() { const [handle, setHandle] = useState("") const [pending, setPending] = useState(false) const [error, setError] = useState("") return (

Log in

Continue with your ATProto account. Your PDS will confirm the permissions Crate needs.

{ event.preventDefault() if (!handle.trim()) return setPending(true) setError("") try { const { redirectUrl } = await login(handle.trim()) window.location.assign(redirectUrl) } catch (error) { setError(error instanceof Error ? error.message : "Login failed.") setPending(false) } }} > {error && (

{error}

)}
) }