17 lines
412 B
TypeScript
17 lines
412 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
import { findAgentBySlug } from "@/lib/agents";
|
|
|
|
export async function GET(
|
|
_request: Request,
|
|
{ params }: { params: Promise<{ slug: string }> },
|
|
) {
|
|
const { slug } = await params;
|
|
const agent = await findAgentBySlug(slug);
|
|
if (!agent) {
|
|
return NextResponse.json({ error: "agent_not_found" }, { status: 404 });
|
|
}
|
|
|
|
return NextResponse.json(agent);
|
|
}
|