Files
homepage/src/routes/[cospendRoot=cospendRoot]/payments/edit/[id]/+page.server.ts
T
Alexander c912afd46a perf: reuse locals.session from hook in all remaining routes
Extends the previous loader-only sweep across the full tree: every
remaining `await locals.auth()` now falls back through
`locals.session ?? await locals.auth()`, so the hook's cached result
is reused.

68 files, 107 sites touched — loaders, form actions, and API
endpoints across cospend / tasks / fitness / faith / recipe / admin.
hooks.server.ts is intentionally left alone since it's the originating
call that populates locals.session in the first place.
2026-04-23 15:08:10 +02:00

15 lines
333 B
TypeScript

import type { PageServerLoad } from './$types';
import { redirect } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ locals, params }) => {
const session = locals.session ?? await locals.auth();
if (!session) {
throw redirect(302, '/login');
}
return {
session,
paymentId: params.id
};
};