diff --git a/www/components/homepage/FormsSection.tsx b/www/components/homepage/FormsSection.tsx index 8b2ca368..fa6305b3 100644 --- a/www/components/homepage/FormsSection.tsx +++ b/www/components/homepage/FormsSection.tsx @@ -8,23 +8,21 @@ import { ExampleArrow } from "../homepage/ExampleArrow.tsx"; import { FancyLink } from "../FancyLink.tsx"; import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx"; -const routingCode = `import { Handlers } from "$fresh/server.ts"; +const routingCode = `import { define } from "../utils.ts"; -export const handler: Handlers = { - async POST(req) { - const form = await req.formData(); +export const handler = define.handlers({ + async POST(ctx) { + const form = await ctx.req.formData(); // Do something with the form data here, // then redirect user to thank you page - const headers = new Headers(); - headers.set("location", "/thanks"); return new Response(null, { status: 303, - headers, + headers: { location: "/thanks" }, }); }, -};`; +});`; export function FormsSection() { return ( diff --git a/www/components/homepage/PartialsSection.tsx b/www/components/homepage/PartialsSection.tsx index 9b40fe18..ab1db6fc 100644 --- a/www/components/homepage/PartialsSection.tsx +++ b/www/components/homepage/PartialsSection.tsx @@ -8,7 +8,7 @@ import { ExampleArrow } from "../../components/homepage/ExampleArrow.tsx"; import { RecipeDemo } from "../../components/homepage/RecipeDemo.tsx"; import { FancyLink } from "../../components/FancyLink.tsx"; -const islandCode = `import { Partial } from "$fresh/runtime.ts"; +const islandCode = `import { Partial } from "fresh/runtime"; export const Recipes = () => (