20 lines
462 B
TypeScript
20 lines
462 B
TypeScript
|
|
import { prisma } from "@/app/lib/prisma"
|
||
|
|
import { NextResponse } from "next/server"
|
||
|
|
|
||
|
|
export async function GET(
|
||
|
|
request: Request,
|
||
|
|
{ params }: { params: Promise<{ slug: string }> }
|
||
|
|
) {
|
||
|
|
const { slug } = await params
|
||
|
|
const agent = await prisma.agent.findUnique({
|
||
|
|
where: { slug },
|
||
|
|
include: { category: true },
|
||
|
|
})
|
||
|
|
|
||
|
|
if (!agent) {
|
||
|
|
return NextResponse.json({ error: "Agent not found" }, { status: 404 })
|
||
|
|
}
|
||
|
|
|
||
|
|
return NextResponse.json(agent)
|
||
|
|
}
|