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

@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import Navbar from "./_components/navbar/Navbar";
import { redirect } from "next/navigation";
import { getServerSession } from "../api/auth/[...nextauth]/auth";
import { Error } from "_components/Error";
export const metadata: Metadata = {
title: "VAR v2: Pilot",
@@ -14,9 +15,12 @@ export default async function RootLayout({
children: React.ReactNode;
}>) {
const session = await getServerSession();
if (!session) {
redirect("/login");
}
if (!session.user.permissions.includes("PILOT"))
return <Error title="Zugriff verweigert" statusCode={403} />;
return (
<>
<Navbar />