CoastalCommitsPastes/client/app/admin/page.tsx

23 lines
482 B
TypeScript
Raw Normal View History

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