adding additional backend logging on plan trigger

This commit is contained in:
Khalim Conn-Kowlessar 2025-04-16 11:40:49 +01:00
parent 8594819a98
commit c72998fa81

View file

@ -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,
});