gg
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import AdminContent from "@/components/admin/admin-content";
|
||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||
import { isAdminRole } from "@/lib/auth/roles";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata() {
|
||||
const t = await getTranslations();
|
||||
@@ -10,6 +14,12 @@ export async function generateMetadata() {
|
||||
};
|
||||
}
|
||||
|
||||
export default function AdminPage() {
|
||||
export default async function AdminPage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
if (!isAdminRole(session?.user?.roles)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <AdminContent />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user