refactor: remove some duplicated code
This commit is contained in:
@ -2,10 +2,9 @@ import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { IngredientsList } from "@islands/IngredientsList.tsx";
|
||||
import { RecipeHero } from "@components/RecipeHero.tsx";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Recipe } from "@lib/recipes.ts";
|
||||
import { getRecipe } from "../api/recipes/[name].ts";
|
||||
import Counter from "@islands/Counter.tsx";
|
||||
import { useSignal } from "@preact/signals";
|
||||
import { getRecipe, Recipe } from "@lib/resource/recipes.ts";
|
||||
|
||||
export const handler: Handlers<Recipe | null> = {
|
||||
async GET(_, ctx) {
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { RecipeCard } from "@components/RecipeCard.tsx";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Recipe } from "@lib/recipes.ts";
|
||||
import { getRecipes } from "../api/recipes/index.ts";
|
||||
import { getAllRecipes, Recipe } from "@lib/resource/recipes.ts";
|
||||
import IconArrowLeft from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/arrow-left.tsx";
|
||||
|
||||
export const handler: Handlers<Recipe[] | null> = {
|
||||
async GET(_, ctx) {
|
||||
const recipes = await getRecipes();
|
||||
const recipes = await getAllRecipes();
|
||||
return ctx.render(recipes);
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user