fix: make it work with new vite
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Context, PageProps } from "fresh";
|
||||
import { PageProps } from "fresh";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Grid } from "@components/Grid.tsx";
|
||||
import { TbArrowLeft } from "@preact-icons/tb";
|
||||
@@ -8,9 +8,10 @@ import { ResourceCard } from "@components/Card.tsx";
|
||||
import { listResources } from "@lib/marka/index.ts";
|
||||
import { parseResourceUrl, searchResource } from "@lib/search.ts";
|
||||
import { GenericResource, RecipeResource } from "@lib/marka/schema.ts";
|
||||
import { define } from "../../utils.ts";
|
||||
|
||||
export const handler = {
|
||||
async GET(ctx: Context<{ test: number }>) {
|
||||
export const handler = define.handlers({
|
||||
async GET(ctx) {
|
||||
const req = ctx.req;
|
||||
const recipes = await listResources<RecipeResource>("recipes");
|
||||
const searchParams = parseResourceUrl(req.url);
|
||||
@@ -18,9 +19,9 @@ export const handler = {
|
||||
await searchResource({ ...searchParams, types: ["recipes"] });
|
||||
return { data: { recipes, searchResults } };
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export default function Page(
|
||||
export default define.page(function (
|
||||
{ data, url }: PageProps<{
|
||||
recipes: RecipeResource[] | null;
|
||||
searchResults: GenericResource[];
|
||||
@@ -54,4 +55,4 @@ export default function Page(
|
||||
</Grid>
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user