diff --git a/apps/hq/src/components/forms/FormOverviewPage.tsx b/apps/hq/src/components/forms/FormOverviewPage.tsx index 649834c859..2de9b1e4ad 100644 --- a/apps/hq/src/components/forms/FormOverviewPage.tsx +++ b/apps/hq/src/components/forms/FormOverviewPage.tsx @@ -149,7 +149,7 @@ export default function FormOverviewPage() { id="captureUrl" type="text" className="focus:border-brand focus:ring-brand block w-full rounded-r-md border-gray-300 bg-gray-100 shadow-sm sm:text-sm" - value={`${window.location.protocol}//${window.location.host}/capture/forms/${form.id}/submissions`} + value={`${window.location.protocol}//${window.location.host}/api/capture/forms/${form.id}/submissions`} disabled /> @@ -220,7 +220,7 @@ export default function FormOverviewPage() { id="captureUrl" type="text" className="focus:border-brand focus:ring-brand block w-full rounded-r-md border-gray-300 bg-gray-100 shadow-sm sm:text-sm" - value={`${window.location.protocol}//${window.location.host}/capture/forms/${form.id}/submissions`} + value={`${window.location.protocol}//${window.location.host}/api/capture/forms/${form.id}/submissions`} disabled /> @@ -317,17 +317,35 @@ return (
                   
-                    {`
{ - fetch("${window.location.protocol}//${window.location.host}/capture/forms/${form.id}/submissions", { - method: "POST", - body: JSON.stringify({data}), - headers: { - Accept: "application/json", - }, - }); -}}> -{/* YOUR FORM */} + {` + { + e.preventDefault(); + fetch( + "${window.location.protocol}//${window.location.host}/api/capture/forms/${form.id}/submissions", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + data: { + firstname: e.target.firstname.value, + email: e.target.email.value, + }, + }), + } + ); + console.log("submission sent!"); + e.target.reset(); +}} +> + + + + + +
`}