progressively updating to use api
This commit is contained in:
@@ -9,26 +9,7 @@ import InfoView from "@/components/Detail/InfoView";
|
||||
|
||||
const { recipeid } = Astro.params;
|
||||
|
||||
const re2 = await client2.getRecipe(recipeid as string)
|
||||
console.log(re2)
|
||||
|
||||
const re = await client.collection("recipes").getOne(recipeid ?? "0");
|
||||
|
||||
const stepIds = re.steps
|
||||
|
||||
let steps = await Promise.all(
|
||||
stepIds.map(async s =>
|
||||
await client.collection("steps").getOne(s)
|
||||
)
|
||||
)
|
||||
|
||||
steps = steps.sort((a, b) => a.index - b.index);
|
||||
|
||||
const ingredients = await Promise.all(
|
||||
re.ingredients.map(async s =>
|
||||
await client.collection("ingredients").getOne(s)
|
||||
)
|
||||
)
|
||||
const re = await client2.getRecipe(recipeid as string)
|
||||
---
|
||||
|
||||
<SiteLayout>
|
||||
@@ -41,12 +22,12 @@ const ingredients = await Promise.all(
|
||||
<InfoView re={re} />
|
||||
|
||||
<p class="text-[22pt] font-bold 'md:mt-4'">Ingredients</p>
|
||||
<IngredientTableView class:list={['md:w-80', 'px-4']} ingredients={ingredients} />
|
||||
<IngredientTableView class:list={['md:w-80', 'px-4']} ingredients={re.expand.ingredients} />
|
||||
</div>
|
||||
|
||||
<div class="flex mt-4 md:flex-2/3 w-full flex-col">
|
||||
<!-- Steps -->
|
||||
<StepView class="md:ml-3" steps={steps} />
|
||||
<StepView class="md:ml-3" steps={re.expand.steps} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user