This commit is contained in:
Alexander Bocken 2023-07-19 15:59:54 +02:00
parent 2b0c954aa5
commit 59ab194b08
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
3 changed files with 4 additions and 10 deletions

View File

@ -1,11 +1,8 @@
import type {LayoutServerLoad} from './$types';
import { authenticateUser } from '$lib/js/authenticate';; import { authenticateUser } from '$lib/js/authenticate';;
export const load = (async ({cookies}) => { export const load = (async ({cookies}) => {
const user = await authenticateUser(cookies) const user = await authenticateUser(cookies)
console.log("LOAD LAYOUT")
console.log(user)
return { return {
user user
} }
}) satisfies LayoutServerLoad; });

View File

@ -1,6 +1,6 @@
import type { PageServerLoad } from "./$types"; import type { PageServerLoad } from "./$types";
export async function load({ fetch, locals }) { export async function load({ fetch }) {
let current_month = new Date().getMonth() + 1 let current_month = new Date().getMonth() + 1
const res_season = await fetch(`/api/items/in_season/` + current_month); const res_season = await fetch(`/api/items/in_season/` + current_month);
const res_all_brief = await fetch(`/api/items/all_brief`); const res_all_brief = await fetch(`/api/items/all_brief`);
@ -9,6 +9,5 @@ export async function load({ fetch, locals }) {
return { return {
season: item_season, season: item_season,
all_brief: item_all_brief, all_brief: item_all_brief,
user: locals.user,
}; };
}; };

View File

@ -19,7 +19,7 @@ h1{
</style> </style>
<h1>Rezepte</h1> <h1>Rezepte</h1>
<section> <section>
<MediaScroller title="In Saison:"> <MediaScroller title="In Saison">
{#each data.season as recipe} {#each data.season as recipe}
<Card {recipe} {current_month} search=""></Card> <Card {recipe} {current_month} search=""></Card>
{/each} {/each}
@ -34,6 +34,4 @@ h1{
{/each} {/each}
</MediaScroller> </MediaScroller>
{/each} {/each}
{#if data.user && data.user.access.includes("rezepte")} <AddButton></AddButton>
<AddButton></AddButton>
{/if}