feat(auth): add role guards and protect admin routes

This commit is contained in:
2026-06-04 21:57:39 +02:00
parent 601dea9526
commit 12cbec92a0
8 changed files with 114 additions and 27 deletions
+4 -1
View File
@@ -3,15 +3,18 @@ import { Toaster } from "sonner"
import Navbar from "@/components/layout/navbar"
import AppSidebar from "@/components/layout/sidebar"
import { SidebarProvider } from "@/components/ui/sidebar"
import { auth } from "@/lib/auth"
export default async function LayoutDashboard({
children,
}: {
children: React.ReactNode
}) {
const session = await auth()
return (
<SidebarProvider>
<AppSidebar />
<AppSidebar userRole={session?.user.role} />
<main className="w-full">
<Navbar />
<div className="flex-1 p-6">{children}</div>