- Centralize user menu, sidebar items, and breadcrumb logic. - Map consistent API endpoints in `customerRoutes`. - Replace inline route definitions with reusable constants. - Refactor auth configuration file location. - Improve `<Link>` usage to replace static `<a>` elements. - Adjust sidebar and dropdown components to use dynamic navigation configurations.
15 lines
539 B
TypeScript
15 lines
539 B
TypeScript
import {NextRequest, NextResponse} from "next/server";
|
|
import {serverCall} from "@/lib/api/serverCall";
|
|
import {customerRoutes} from "@/app/api/customers/customerRoutes";
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const id = request.url.split('/').pop();
|
|
const response = await serverCall(customerRoutes.getById(id!), "GET");
|
|
|
|
if (!response.ok) {
|
|
return NextResponse.json({error: "Customer not found"}, {status: 404});
|
|
}
|
|
|
|
const customer = await response.json();
|
|
return NextResponse.json(customer);
|
|
} |