Updates the examples on the homepage (#3682)
The example island and partials are using the old import styles, this PR updates those examples. --------- Signed-off-by: Jason McCallister <jason@mccallister.dev> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
co-authored by
Bartek Iwańczuk
parent
689f1881e2
commit
1c2b5f50b4
@@ -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 (
|
||||
|
||||
@@ -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 = () => (
|
||||
<div f-client-nav>
|
||||
|
||||
Reference in New Issue
Block a user