Customer Detail Page and Enhance dynamic breadcrumbs
This commit is contained in:
14
internal_frontend/app/api/customers/[id]/route.ts
Normal file
14
internal_frontend/app/api/customers/[id]/route.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {serverCall} from "@/lib/api/serverCall";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const id = request.url.split('/').pop();
|
||||
const response = await serverCall(`/customers/${id}`, "GET");
|
||||
|
||||
if (!response.ok) {
|
||||
return NextResponse.json({error: "Customer not found"}, {status: 404});
|
||||
}
|
||||
|
||||
const customer = await response.json();
|
||||
return NextResponse.json(customer);
|
||||
}
|
||||
Reference in New Issue
Block a user