"use client"; import { useActionState, useEffect } from "react"; import { useRouter } from "next/navigation"; import { forceChangePasswordAction } from "./actions"; export function ForceChangeForm() { const router = useRouter(); const [state, formAction, isPending] = useActionState(forceChangePasswordAction, null); useEffect(() => { if (state && "success" in state && state.success) { router.push("/dashboard"); router.refresh(); } }, [state, router]); const inputStyle = { width: "100%", padding: "0.5rem 0.75rem", fontSize: "16px", border: "2px solid var(--border)", background: "var(--background)", outline: "none", fontFamily: "inherit", } as React.CSSProperties; return (
{state && "error" in state && state.error && (

{state.error}

)}
); }