Fix 502 error when authenticated users directly navigate to /rezepte behind reverse proxy
All checks were successful
CI / update (push) Successful in 18s
All checks were successful
CI / update (push) Successful in 18s
Remove redundant locals.auth() call to prevent concurrent session verification issues. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +1,18 @@
|
|||||||
import type { PageServerLoad } from "./$types";
|
import type { PageServerLoad } from "./$types";
|
||||||
import { getUserFavorites, addFavoriteStatusToRecipes } from "$lib/server/favorites";
|
import { getUserFavorites, addFavoriteStatusToRecipes } from "$lib/server/favorites";
|
||||||
|
|
||||||
export async function load({ fetch, locals }) {
|
export async function load({ fetch, locals, parent }) {
|
||||||
let current_month = new Date().getMonth() + 1
|
let current_month = new Date().getMonth() + 1
|
||||||
const res_season = await fetch(`/api/rezepte/items/in_season/` + current_month);
|
const res_season = await fetch(`/api/rezepte/items/in_season/` + current_month);
|
||||||
const res_all_brief = await fetch(`/api/rezepte/items/all_brief`);
|
const res_all_brief = await fetch(`/api/rezepte/items/all_brief`);
|
||||||
const item_season = await res_season.json();
|
const item_season = await res_season.json();
|
||||||
const item_all_brief = await res_all_brief.json();
|
const item_all_brief = await res_all_brief.json();
|
||||||
|
|
||||||
// Get user favorites and session
|
// Get user favorites (session comes from parent layout)
|
||||||
const [userFavorites, session] = await Promise.all([
|
const userFavorites = await getUserFavorites(fetch, locals);
|
||||||
getUserFavorites(fetch, locals),
|
|
||||||
locals.auth()
|
|
||||||
]);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
season: addFavoriteStatusToRecipes(item_season, userFavorites),
|
season: addFavoriteStatusToRecipes(item_season, userFavorites),
|
||||||
all_brief: addFavoriteStatusToRecipes(item_all_brief, userFavorites),
|
all_brief: addFavoriteStatusToRecipes(item_all_brief, userFavorites)
|
||||||
session
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user