fix(admin): add /admin index redirect and point root redirect at it
/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 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc2079db77
commit
7e50c7c2fd
2 files changed
+8
-1
No files matched your search
@@ -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");
|
||||
}
|
||||
+1
-1
@@ -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 (
|
||||
|
||||
Reference in new issue
Block a user