first working prototype
This commit is contained in:
19
src/routes/rezepte/season/[month]/+page.svelte
Normal file
19
src/routes/rezepte/season/[month]/+page.svelte
Normal file
@ -0,0 +1,19 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import Recipes from '$lib/components/Recipes.svelte';
|
||||
import SeasonLayout from '$lib/components/SeasonLayout.svelte';
|
||||
import '$lib/components/card.css';
|
||||
import MediaScroller from '$lib/components/MediaScroller.svelte';
|
||||
import Card from '$lib/components/Card.svelte';
|
||||
import Search from '$lib/components/Search.svelte';
|
||||
export let data: PageData;
|
||||
let months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
|
||||
</script>
|
||||
<SeasonLayout>
|
||||
<h2 slot=test>Rezepte die im {months[data.month-1]} in Saison sind</h2>
|
||||
<Recipes slot=recipes>
|
||||
{#each data.season as recipe}
|
||||
<Card {recipe} icon_override=true></Card>
|
||||
{/each}
|
||||
</Recipes>
|
||||
</SeasonLayout>
|
12
src/routes/rezepte/season/[month]/+page.ts
Normal file
12
src/routes/rezepte/season/[month]/+page.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export async function load({ fetch, params }) {
|
||||
const res_season = await fetch(`/api/items/in_season/` + params.month);
|
||||
const res_all_brief = await fetch(`/api/items/all_brief`);
|
||||
const item_season = await res_season.json();
|
||||
const item_all_brief = await res_all_brief.json();
|
||||
return {
|
||||
month: params.month,
|
||||
season: item_season,
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user