Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/blog/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { PostContainer } from './component'
import { createSmartClient } from '@/lib/smartClient'
import BlogDiscussions from '@/components/BlogDiscussions'
import { getServerSession } from 'next-auth/next'
import { authOptions } from '@/lib/auth'
import { createSmartClient } from '@/lib/smartClient'
import BlogDiscussions from '@/components/BlogDiscussions'

export const revalidate = process.env.NODE_ENV === 'development' ? 0 : 60;

export default async function Page({ params }: { params: { id: string } }) {
const session = await getServerSession(authOptions);
const session = await getServerSession(authOptions)
const client = createSmartClient(session?.accessToken)
const posts = await client.getBlogPosts()
const post = posts.find((p) => p.id === decodeURIComponent(params.id))
const post = await client.getBlogPost(decodeURIComponent(params.id) + '.md')

if (!post) {
return <div>Post not found</div>
Expand Down
Loading