From 7e50c7c2fdaf26524e52681fc47395409d49c465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Tue, 11 Aug 2026 00:43:29 +0200 Subject: [PATCH] fix(admin): add /admin index redirect and point root redirect at it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /admin had no index page (only /admin/redaktionen, /abrechnungen, /audit), so authenticated admins hitting /admin — including the admin layout's wordmark link — got a 404. Add src/app/admin/page.tsx that redirects to /admin/redaktionen, and point the root home redirect at the same path so post-login doesn't 404. Co-Authored-By: Claude --- src/app/admin/page.tsx | 7 +++++++ src/app/page.tsx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/app/admin/page.tsx diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx new file mode 100644 index 0000000..4d15373 --- /dev/null +++ b/src/app/admin/page.tsx @@ -0,0 +1,7 @@ +import { redirect } from "next/navigation"; + +// /admin has no dashboard of its own; the admin layout's wordmark links here, +// so route authenticated admins to the editorials list instead of 404ing. +export default function AdminIndexPage() { + redirect("/admin/redaktionen"); +} \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index 0a6dc2c..46c3d61 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -13,7 +13,7 @@ export default async function HomePage() { // `role` is a custom column; Better Auth returns it (the drizzle adapter // selects all columns) but doesn't type it. Mirror principal.ts's cast. const role = (session.user as { role?: string }).role; - redirect(role === "ADMIN" ? "/admin" : "/redaktion/alben"); + redirect(role === "ADMIN" ? "/admin/redaktionen" : "/redaktion/alben"); } return (