diff --git a/www/components/CodeWindow.tsx b/www/components/CodeWindow.tsx index fdaebadd..a91eccfe 100644 --- a/www/components/CodeWindow.tsx +++ b/www/components/CodeWindow.tsx @@ -8,7 +8,7 @@ export function CodeWindow(props: CodeWindowProps) { return (
diff --git a/www/components/homepage/FormsSection.tsx b/www/components/homepage/FormsSection.tsx
index 8043b54c..bbf87812 100644
--- a/www/components/homepage/FormsSection.tsx
+++ b/www/components/homepage/FormsSection.tsx
@@ -6,19 +6,19 @@ import { SectionHeading } from "$fresh/www/components/homepage/SectionHeading.ts
import { DemoBox } from "$fresh/www/components/homepage/DemoBox.tsx";
import { ExampleArrow } from "$fresh/www/components/homepage/ExampleArrow.tsx";
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
+import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx";
const routingCode = `import { Handlers } from "$fresh/server.ts";
export const handler: Handlers = {
- async POST(req, ctx) {
+ async POST(req) {
const form = await req.formData();
- const email = form.get("email")?.toString();
- // Save email to database here
+ // Do something with the form data here,
+ // then redirect user to thank you page
- // Redirect user to thank you page.
const headers = new Headers();
- headers.set("location", "/thanks-for-subscribing");
+ headers.set("location", "/thanks");
return new Response(null, {
status: 303,
headers,
@@ -28,9 +28,9 @@ export const handler: Handlers = {
export function FormsSection() {
return (
-
Don't fight the browser. Fresh helps you handle form submissions and
- other dynamic requests server-side, simply and easily.
+ other dynamic requests server-side, from any route.
Since Fresh is built on{" "}
@@ -77,14 +77,10 @@ export function FormsSection() {
lang="jsx"
/>
- {
- /*
- TODO: something goes here.
-
+
The simple, approachable, productive web framework