add auth
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import { getServerSession } from '@/lib/auth'
|
||||
import ManageSubNav from '@/components/ManageSubNav'
|
||||
|
||||
export default function ManageLayout({ children }: { children: React.ReactNode }) {
|
||||
export default async function ManageLayout({ children }: { children: React.ReactNode }) {
|
||||
const session = await getServerSession()
|
||||
if (!session.userId) redirect('/login')
|
||||
if (session.role !== 'admin') redirect('/')
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ManageSubNav />
|
||||
|
||||
Reference in New Issue
Block a user