diff --git a/src/components/Card/OverviewCard.astro b/src/components/Card/OverviewCard.astro index 8a73c9e..bd226c2 100644 --- a/src/components/Card/OverviewCard.astro +++ b/src/components/Card/OverviewCard.astro @@ -4,8 +4,7 @@ import TagRow from "./TagRow.astro" const { recipe } = Astro.props; -const headerImage = await client.collection("images").getOne(recipe.images[0]) -const image = await client.files.getRelativeURL(headerImage, headerImage.image) +const image = (await client.getRecipeImages(recipe.id))[0] ---
@@ -19,7 +18,7 @@ const image = await client.files.getRelativeURL(headerImage, headerImage.image)
- +
diff --git a/src/components/Card/TagRow.astro b/src/components/Card/TagRow.astro index 28ec731..e1a644e 100644 --- a/src/components/Card/TagRow.astro +++ b/src/components/Card/TagRow.astro @@ -1,17 +1,10 @@ --- -import client from "../../data/pocketbase" - -interface Props { - tags: string[] -} - const { tags } = Astro.props - ---
{ - tags.map(tag => ( + (tags ?? []).map(tag => ( (Collection.RECIPES).getFullList({ expand: "steps,ingredients,tags" }) + return await this.client.collection(Collection.RECIPES).getFullList({ expand: 'ingredients,tags,steps,images,steps.ingredients' }) } async getRecipe(id: string) { diff --git a/src/pages/index.astro b/src/pages/index.astro index bf1ef86..592c409 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,7 +3,7 @@ import PageLayout from "@/layouts/base" import client from "@/data/pocketbase" import OverviewCard from "@/components/Card/OverviewCard" -const recipies = await client.collection("recipes").getFullList() +const recipes = await client.getAllRecipes() --- @@ -11,7 +11,7 @@ const recipies = await client.collection("recipes").getFullList()
{ - recipies.map(r => ( + recipes.map(r => ( )) }