Add project management support and integrate customer-project functionality
This commit is contained in:
21
internal_frontend/app/api/projects/route.ts
Normal file
21
internal_frontend/app/api/projects/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {serverCall} from "@/lib/api/serverCall";
|
||||
import {projectRoutes} from "@/app/api/projects/projectRoutes";
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
// Parse the incoming JSON payload
|
||||
const body = await req.json();
|
||||
|
||||
// Make a POST request to the backend using serverCall
|
||||
const response = await serverCall(projectRoutes.create, "POST", body);
|
||||
|
||||
// Parse and return the backend response
|
||||
const result = await response.json();
|
||||
return NextResponse.json(result);
|
||||
} catch (error) {
|
||||
// Handle errors gracefully
|
||||
console.error("Error creating project:", error);
|
||||
return NextResponse.json({error: "Failed to create project"}, {status: 500});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user