From c72998fa815dbcda8ce96ded31c3d2fe900476bf Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 16 Apr 2025 11:40:49 +0100 Subject: [PATCH] adding additional backend logging on plan trigger --- src/app/api/plan/trigger/route.ts | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/app/api/plan/trigger/route.ts b/src/app/api/plan/trigger/route.ts index 92f3096..e2adaff 100644 --- a/src/app/api/plan/trigger/route.ts +++ b/src/app/api/plan/trigger/route.ts @@ -43,34 +43,21 @@ export async function POST(request: NextRequest) { }`, "Content-Type": "application/json", }; - // const response = await fetch( - // `${process.env.FASTAPI_API_URL}/v1/plan/trigger`, - // { - // method: "POST", - // headers: headers, - // body: JSON.stringify(validatedBody), - // } - // ); - - // if (!response.ok) { - // throw new Error("API request failed"); - // } - - // const responseData = await response.json(); - - // return new NextResponse(JSON.stringify(responseData), { - // status: 200, - // }); console.log("Triggering plan with body: ", validatedBody); + const url = `${process.env.FASTAPI_API_URL}/v1/plan/trigger`; + console.log("Triggering plan with url: ", url); + // For the moment, we don't await any response from the backend, since we haven't split out the trigger - fetch(`${process.env.FASTAPI_API_URL}/v1/plan/trigger`, { + fetch(url, { method: "POST", headers: headers, body: JSON.stringify(validatedBody), }); + console.log("Plan triggered successfully"); + return new NextResponse(JSON.stringify({ msg: "Job started" }), { status: 200, });