Changed error boundary to cover both full hub and disaptch app

This commit is contained in:
PxlLoewe
2025-05-29 22:25:30 -07:00
parent d968507484
commit 0cebe2b97e
24 changed files with 226 additions and 194 deletions

View File

@@ -1,21 +1,12 @@
import { prisma } from "@repo/db";
import { Error } from "_components/Error";
import { getServerSession } from "api/auth/[...nextauth]/auth";
export default async function ReportLayout({
children,
}: {
children: React.ReactNode;
}) {
export default async function ReportLayout({ children }: { children: React.ReactNode }) {
const session = await getServerSession();
if (!session) return <Error title="Nicht eingeloggt" statusCode={401} />;
const user = await prisma.user.findUnique({
where: {
id: session.user.id,
},
});
const user = session.user;
if (!user?.permissions.includes("ADMIN_EVENT"))
return <Error title="Keine Berechtigung" statusCode={403} />;