Changed error boundary to cover both full hub and disaptch app
This commit is contained in:
@@ -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} />;
|
||||
|
||||
Reference in New Issue
Block a user