Files
portabase/app/(customer)/dashboard/(admin)/layout.tsx
T

14 lines
372 B
TypeScript
Raw Normal View History

2024-12-31 10:54:18 +01:00
import React from "react";
2025-05-16 15:54:17 +02:00
import { notFound } from "next/navigation";
import { currentUser } from "@/lib/auth/current-user";
2024-12-31 10:54:18 +01:00
2025-05-16 15:54:17 +02:00
export default async function Layout({ children }: { children: React.ReactNode }) {
const user = await currentUser();
2024-12-31 10:54:18 +01:00
2025-05-16 15:54:17 +02:00
if (user!.role !== "superadmin" && user!.role !== "admin") {
notFound();
2024-12-31 10:54:18 +01:00
}
2025-05-16 15:54:17 +02:00
return <>{children}</>;
}