diff --git a/superpage/src/components/Course/Contact.jsx b/superpage/src/components/Course/Contact.jsx index 0dd3e17..a040c92 100644 --- a/superpage/src/components/Course/Contact.jsx +++ b/superpage/src/components/Course/Contact.jsx @@ -1,6 +1,6 @@ +import { createElement, useEffect } from "react"; import { Form, useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; -import { createElement } from "react"; import clsx from "clsx"; import { z } from "zod"; @@ -18,16 +18,25 @@ const schema = z.object({ }); export default function Contact({ url }) { - const { register, formState, control, reset } = useForm({ + const { register, formState, control, reset, setValue } = useForm({ resolver: zodResolver(schema), }); + useEffect(() => { + const handler = (e) => { + setValue("plan", e.detail); + }; + + window.addEventListener("planUpdate", handler); + + return () => { + window.removeEventListener("planUpdate", handler); + }; + }, [setValue]); + return (
{ - return { url, ...data }; - }} onSuccess={() => reset()} control={control} className="flex flex-col gap-3" @@ -38,6 +47,9 @@ export default function Contact({ url }) {

)} + + + {/* Modal */}
@@ -35,6 +40,7 @@ import Contact from "./Contact.jsx";

Preencha os dados da sua empresa

+
@@ -69,7 +75,7 @@ import Contact from "./Contact.jsx"; de agilidade.