Merge pull request #44 from Hestia-Homes/costs-migration

Adding header logging and error catching on fetch
This commit is contained in:
KhalimCK 2025-04-16 13:41:14 +01:00 committed by GitHub
commit c8e6464491
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,12 +48,15 @@ export async function POST(request: NextRequest) {
const url = `${process.env.FASTAPI_API_URL}/v1/plan/trigger`;
console.log("Triggering plan with url: ", url);
console.log("Triggering plan with headers: ", headers);
// For the moment, we don't await any response from the backend, since we haven't split out the trigger
fetch(url, {
void fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(validatedBody),
}).catch((err) => {
console.error("Error triggering FastAPI plan:", err);
});
console.log("Plan triggered successfully");