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 { fetchPageBySlug } from '@/fetch/pages'
|
||||||
import { Blocks } from '@/compositions/Blocks/Blocks'
|
import { Blocks } from '@/compositions/Blocks/Blocks'
|
||||||
import { Metadata } from 'next'
|
import { Metadata } from 'next'
|
||||||
|
import { AdminMenu } from '@/components/AdminMenu/AdminMenu'
|
||||||
|
import { isAuthenticated } from '@/utils/auth'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
params: Promise<{ slug: string }>
|
params: Promise<{ slug: string }>
|
||||||
|
|
@ -22,6 +24,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||||
export default async function DynamicPage({ params }: Props) {
|
export default async function DynamicPage({ params }: Props) {
|
||||||
const slug = (await params).slug
|
const slug = (await params).slug
|
||||||
const page = await fetchPageBySlug(slug)
|
const page = await fetchPageBySlug(slug)
|
||||||
|
const authenticated = await isAuthenticated()
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
notFound()
|
notFound()
|
||||||
|
|
@ -32,6 +35,12 @@ export default async function DynamicPage({ params }: Props) {
|
||||||
{page.content && page.content.length > 0 && (
|
{page.content && page.content.length > 0 && (
|
||||||
<Blocks content={page.content} />
|
<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} />
|
<Blocks content={data.content.content} />
|
||||||
|
|
||||||
<AdminMenu
|
<AdminMenu
|
||||||
collection={"worship"}
|
collection={"blog"}
|
||||||
id={id}
|
id={id}
|
||||||
isAuthenticated={authenticated}
|
isAuthenticated={authenticated}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue