You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Drift/client/app/admin/page.tsx

23 lines
482 B
TypeScript

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