"use client" import { UserRole } from "@prisma/client"; import { useSession } from "next-auth/react"; import React from "react"; interface RoleGateProps { children: React.ReactNode roles: UserRole[] } export const RoleGate = ({ children, roles, }: RoleGateProps) => { const session = useSession() const role = session?.data?.user.role as UserRole if (roles.includes(role)) { return (
{ children }
); } return
} export default RoleGate