From f83c712b2b15fa3a04430533a06814e0db41b26d Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sun, 22 Feb 2026 11:50:14 +0100 Subject: [PATCH] fix: remove PageServerLoad annotations from disabled routes The auth and profile layout redirects break SvelteKit's type generation for child page loads, causing false-positive type errors where PageData requires `user` from the root layout. --- web/src/routes/auth/anmelden/+page.server.ts | 4 ++-- web/src/routes/auth/registrieren/+page.server.ts | 4 ++-- web/src/routes/profile/+page.server.ts | 5 ++--- web/src/routes/profile/security/+page.server.ts | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/web/src/routes/auth/anmelden/+page.server.ts b/web/src/routes/auth/anmelden/+page.server.ts index 41ea7cf..987bb89 100644 --- a/web/src/routes/auth/anmelden/+page.server.ts +++ b/web/src/routes/auth/anmelden/+page.server.ts @@ -1,10 +1,10 @@ -import type { Actions, PageServerLoad } from './$types.js'; +import type { Actions } from './$types.js'; import { fail, redirect } from '@sveltejs/kit'; import { apiFetch, ApiClientError } from '$lib/api/client.js'; import type { AuthData, MessageData } from '$lib/api/types.js'; import { setAuthCookies } from '$lib/auth/cookies.js'; -export const load: PageServerLoad = async ({ locals, url }) => { +export const load = async ({ locals, url }: { locals: App.Locals; url: URL }) => { if (locals.user) redirect(302, '/'); return { redirectTo: url.searchParams.get('redirect') ?? '/' diff --git a/web/src/routes/auth/registrieren/+page.server.ts b/web/src/routes/auth/registrieren/+page.server.ts index 0d4ff3e..e19bdf8 100644 --- a/web/src/routes/auth/registrieren/+page.server.ts +++ b/web/src/routes/auth/registrieren/+page.server.ts @@ -1,10 +1,10 @@ -import type { Actions, PageServerLoad } from './$types.js'; +import type { Actions } from './$types.js'; import { fail, redirect } from '@sveltejs/kit'; import { apiFetch, ApiClientError } from '$lib/api/client.js'; import type { AuthData } from '$lib/api/types.js'; import { setAuthCookies } from '$lib/auth/cookies.js'; -export const load: PageServerLoad = async ({ locals }) => { +export const load = async ({ locals }: { locals: App.Locals }) => { if (locals.user) redirect(302, '/'); }; diff --git a/web/src/routes/profile/+page.server.ts b/web/src/routes/profile/+page.server.ts index 24bb180..b5974fd 100644 --- a/web/src/routes/profile/+page.server.ts +++ b/web/src/routes/profile/+page.server.ts @@ -1,4 +1,4 @@ -import type { Actions, PageServerLoad } from './$types.js'; +import type { Actions } from './$types.js'; import { fail } from '@sveltejs/kit'; import { requireAuth } from '$lib/auth/guard.js'; import { serverFetch } from '$lib/api/client.server.js'; @@ -7,9 +7,8 @@ import { clearAuthCookies } from '$lib/auth/cookies.js'; import { redirect } from '@sveltejs/kit'; import type { ProfileData } from '$lib/api/types.js'; -export const load: PageServerLoad = async (event) => { +export const load = async (event: Parameters[0]) => { requireAuth(event); - const res = await serverFetch('/users/me', event.cookies, { fetch: event.fetch }); return { profile: res.data }; }; diff --git a/web/src/routes/profile/security/+page.server.ts b/web/src/routes/profile/security/+page.server.ts index 7e49c01..da810d8 100644 --- a/web/src/routes/profile/security/+page.server.ts +++ b/web/src/routes/profile/security/+page.server.ts @@ -1,11 +1,11 @@ -import type { Actions, PageServerLoad } from './$types.js'; +import type { Actions } from './$types.js'; import { fail } from '@sveltejs/kit'; import { requireAuth } from '$lib/auth/guard.js'; import { serverFetch } from '$lib/api/client.server.js'; import { ApiClientError } from '$lib/api/client.js'; import type { TOTPSetupData, MessageData } from '$lib/api/types.js'; -export const load: PageServerLoad = async (event) => { +export const load = async (event: Parameters[0]) => { requireAuth(event); return {}; };