vendor slugs routes instead of ids

This commit is contained in:
2026-01-27 16:56:57 -05:00
parent aa2f30c086
commit c6ff651f21
10 changed files with 247 additions and 120 deletions

37
app/(auth)/vendors/[slug]/page.tsx vendored Normal file
View File

@@ -0,0 +1,37 @@
// app/(auth)/vendors/[id]/page.tsx
import { notFound } from 'next/navigation'
import { prisma } from '@/lib/prisma'
import { VendorDetailPage } from '@/components/vendor/VendorDetailPage'
interface PageProps {
params: {
slug: string
}
}
export default async function Page({ params }: PageProps) {
const { slug } = params
const vendor = await prisma.vendor.findUnique({
where: { slug },
include: {
address: true,
events: {
select: {
id: true,
name: true,
date: true,
},
orderBy: {
date: 'asc',
},
},
},
})
if (!vendor) {
notFound()
}
return <VendorDetailPage vendor={vendor} />
}