Files
rheinsw-mono-repo/internal_frontend/app/api/customers/[id]/route.ts

14 lines
463 B
TypeScript

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);
}