CoastalCommitsPastes/client/app/admin/page.tsx

19 lines
344 B
TypeScript
Raw Normal View History

import { getCurrentUser } from "@lib/server/session"
2022-11-12 01:28:06 -08:00
import Admin from "./components/admin"
2022-11-09 23:11:36 -08:00
import { notFound } from "next/navigation"
const AdminPage = async () => {
2022-11-12 01:28:06 -08:00
const user = await getCurrentUser();
if (!user) {
2022-11-09 23:11:36 -08:00
return notFound()
}
if (user.role !== "admin") {
2022-11-09 23:11:36 -08:00
return notFound()
}
return <Admin />
}
export default AdminPage