feat: add render function (#2454)

This commit is contained in:
Luca Casonato
2024-05-24 18:31:34 +02:00
committed by GitHub
parent 82d027cbcd
commit f2162d24bf
14 changed files with 123 additions and 64 deletions
+6 -5
View File
@@ -1,20 +1,21 @@
import { page } from "@fresh/core";
import { PageSection } from "../components/PageSection.tsx";
import { DemoBox } from "../components/homepage/DemoBox.tsx";
import { df } from "../utils/state.ts";
import { define } from "../utils/state.ts";
export const handler = df.handlers({
export const handler = define.handlers({
GET(ctx) {
const url = new URL(ctx.req.url);
const search = new URLSearchParams(url.search);
const vote = search.get("vote");
return { data: { vote } };
return page({ vote });
},
});
export default df.page<typeof handler>(function ThanksForSubscribing(
export default define.page<typeof handler>(function ThanksForSubscribing(
props,
) {
const vote = props?.data?.vote ? props.data.vote.replaceAll(/-/g, " ") : null;
const vote = props.data.vote ? props.data.vote.replaceAll(/-/g, " ") : null;
return (
<>
<PageSection>