[taskboard] add agent detail pages
This commit is contained in:
16
app/api/agents/[slug]/route.ts
Normal file
16
app/api/agents/[slug]/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user