Added bannend check
This commit is contained in:
@@ -4,6 +4,7 @@ import { HorizontalNav, VerticalNav } from "../_components/Nav";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { redirect } from "next/navigation";
|
||||
import { getServerSession } from "../api/auth/[...nextauth]/auth";
|
||||
import { Error } from "_components/Error";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "VAR: Hub",
|
||||
@@ -17,6 +18,9 @@ export default async function RootLayout({
|
||||
}>) {
|
||||
const session = await getServerSession();
|
||||
|
||||
if (session?.user.isBanned)
|
||||
return <Error title="You are banned from using this service" statusCode={403} />;
|
||||
|
||||
if (!session) redirect(`/login`);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user