c912afd46a
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.
15 lines
333 B
TypeScript
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
|
|
};
|
|
}; |