2022-11-12 04:28:06 -05:00
|
|
|
import { isUserAdmin } from "@lib/server/prisma"
|
2022-11-11 22:17:44 -05:00
|
|
|
import { getCurrentUser } from "@lib/server/session"
|
2022-11-12 04:28:06 -05:00
|
|
|
import Admin from "./components/admin"
|
|
|
|
import { cookies } from "next/headers"
|
2022-11-10 02:11:36 -05:00
|
|
|
import { notFound } from "next/navigation"
|
|
|
|
|
|
|
|
const AdminPage = async () => {
|
2022-11-12 04:28:06 -05:00
|
|
|
const user = await getCurrentUser();
|
2022-11-11 22:17:44 -05:00
|
|
|
if (!user) {
|
2022-11-10 02:11:36 -05:00
|
|
|
return notFound()
|
|
|
|
}
|
|
|
|
|
2022-11-11 22:17:44 -05:00
|
|
|
if (user.role !== "admin") {
|
2022-11-10 02:11:36 -05:00
|
|
|
return notFound()
|
|
|
|
}
|
|
|
|
|
|
|
|
return <Admin />
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AdminPage
|