add route matcher to fix /login and /logout routes
Some checks failed
CI / update (push) Failing after 2m52s
Some checks failed
CI / update (push) Failing after 2m52s
Use SvelteKit param matcher to constrain [recipeLang] to only match 'recipes' or 'rezepte', preventing it from catching /login, /logout, and other non-recipe routes.
This commit is contained in:
13
src/routes/[recipeLang=recipeLang]/add/+page.server.ts
Normal file
13
src/routes/[recipeLang=recipeLang]/add/+page.server.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export async function load({locals, params}) {
|
||||
// Add is German-only - redirect to German version
|
||||
if (params.recipeLang === 'recipes') {
|
||||
throw redirect(301, '/rezepte/add');
|
||||
}
|
||||
|
||||
const session = await locals.auth();
|
||||
return {
|
||||
user: session?.user
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user