subman-nextjs/src/app/story/[id]/page.tsx

16 lines
351 B
TypeScript
Raw Normal View History

2024-06-11 17:13:56 +00:00
// "use server"
import prisma from "app/lib/db"
2024-06-11 15:17:01 +00:00
async function getStory(id: string) {
const story = await prisma.story.findFirst({ where: { id: Number(id) } })
return story
}
export default async function Page({ params }: { params: { id: string } }) {
const data = await getStory(params.id)
return <div>Title: {data?.title ?? ""}</div>
}