feat: rename helpers to define (#2453)

This commit is contained in:
Luca Casonato
2024-05-24 11:48:32 +02:00
committed by GitHub
parent c57d0ccb2f
commit c9f0ccdce7
9 changed files with 42 additions and 42 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import { asset } from "@fresh/core/runtime";
import { df } from "../utils/state.ts";
export default df.definePage(function App({ Component, state, url }) {
export default df.page(function App({ Component, state, url }) {
return (
<html lang="en">
<head>
+1 -1
View File
@@ -14,7 +14,7 @@ import { SocialProof } from "../components/homepage/SocialProof.tsx";
import { DenoSection } from "../components/homepage/DenoSection.tsx";
import { df } from "../utils/state.ts";
export const handler = df.defineHandlers({
export const handler = df.handlers({
GET(ctx) {
const { req } = ctx;
const accept = req.headers.get("accept");
+1 -1
View File
@@ -9,7 +9,7 @@ import { df } from "../utils/state.ts";
const TITLE = "Showcase | Fresh";
const DESCRIPTION = "Selection of projects that have been built with Fresh.";
export const handler = df.defineHandlers({
export const handler = df.handlers({
GET(ctx) {
ctx.state.title = TITLE;
ctx.state.description = DESCRIPTION;
+2 -2
View File
@@ -2,7 +2,7 @@ import { PageSection } from "../components/PageSection.tsx";
import { DemoBox } from "../components/homepage/DemoBox.tsx";
import { df } from "../utils/state.ts";
export const handler = df.defineHandlers({
export const handler = df.handlers({
GET(ctx) {
const url = new URL(ctx.req.url);
const search = new URLSearchParams(url.search);
@@ -11,7 +11,7 @@ export const handler = df.defineHandlers({
},
});
export default df.definePage<typeof handler>(function ThanksForSubscribing(
export default df.page<typeof handler>(function ThanksForSubscribing(
props,
) {
const vote = props?.data?.vote ? props.data.vote.replaceAll(/-/g, " ") : null;
+2 -2
View File
@@ -1,4 +1,4 @@
import { createHelpers } from "@fresh/core";
import { createDefine } from "@fresh/core";
export interface State {
title?: string;
@@ -7,4 +7,4 @@ export interface State {
noIndex?: boolean;
}
export const df = createHelpers<State>();
export const df = createDefine<State>();