feat: admin menu
This commit is contained in:
parent
f1ba46e551
commit
bb1869ab05
2 changed files with 10 additions and 1 deletions
|
|
@ -2,6 +2,8 @@ import { notFound } from 'next/navigation'
|
|||
import { fetchPageBySlug } from '@/fetch/pages'
|
||||
import { Blocks } from '@/compositions/Blocks/Blocks'
|
||||
import { Metadata } from 'next'
|
||||
import { AdminMenu } from '@/components/AdminMenu/AdminMenu'
|
||||
import { isAuthenticated } from '@/utils/auth'
|
||||
|
||||
type Props = {
|
||||
params: Promise<{ slug: string }>
|
||||
|
|
@ -22,6 +24,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||
export default async function DynamicPage({ params }: Props) {
|
||||
const slug = (await params).slug
|
||||
const page = await fetchPageBySlug(slug)
|
||||
const authenticated = await isAuthenticated()
|
||||
|
||||
if (!page) {
|
||||
notFound()
|
||||
|
|
@ -32,6 +35,12 @@ export default async function DynamicPage({ params }: Props) {
|
|||
{page.content && page.content.length > 0 && (
|
||||
<Blocks content={page.content} />
|
||||
)}
|
||||
|
||||
<AdminMenu
|
||||
collection={"pages"}
|
||||
id={page.id}
|
||||
isAuthenticated={authenticated}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default async function BlogPage({ params }: { params: Promise<{id: string
|
|||
<Blocks content={data.content.content} />
|
||||
|
||||
<AdminMenu
|
||||
collection={"worship"}
|
||||
collection={"blog"}
|
||||
id={id}
|
||||
isAuthenticated={authenticated}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue