fix(erp): enable erp pages and menu items
This commit is contained in:
@@ -9,6 +9,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ path
|
||||
try {
|
||||
const response = await fetch(`http://backend:8080/api/${path}${req.nextUrl.search}`, {
|
||||
method: "GET",
|
||||
cache: 'no-store',
|
||||
headers: {
|
||||
"Authorization": token || "",
|
||||
"Content-Type": "application/json",
|
||||
@@ -77,4 +78,33 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ pat
|
||||
console.error("API proxy error:", error);
|
||||
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE(req: NextRequest, { params }: { params: Promise<{ path: string[] }> }) {
|
||||
const { path: pathArray } = await params;
|
||||
const path = pathArray?.join("/") || "";
|
||||
const token = req.headers.get("authorization");
|
||||
const host = req.headers.get("host");
|
||||
|
||||
try {
|
||||
const response = await fetch(`http://backend:8080/api/${path}${req.nextUrl.search}`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Authorization": token || "",
|
||||
"Content-Type": "application/json",
|
||||
"X-Forwarded-Host": host || "",
|
||||
"X-Original-Host": host || "",
|
||||
},
|
||||
});
|
||||
|
||||
if (response.status === 204) {
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
const data = await response.json().catch(() => ({}));
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} catch (error) {
|
||||
console.error("API proxy error:", error);
|
||||
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user