- 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.
16 lines
554 B
TypeScript
16 lines
554 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() {
|
|
const data = await serverCall(customerRoutes.create, "GET");
|
|
const customers = await data.json();
|
|
return NextResponse.json(customers);
|
|
}
|
|
|
|
export async function POST(req: NextRequest) {
|
|
const body = await req.json()
|
|
const result = await serverCall(customerRoutes.create, "POST", body);
|
|
return NextResponse.json(result.json());
|
|
}
|