diff --git a/apps/Backend/src/routes/patients.ts b/apps/Backend/src/routes/patients.ts index 1e147ae..f511652 100644 --- a/apps/Backend/src/routes/patients.ts +++ b/apps/Backend/src/routes/patients.ts @@ -174,7 +174,7 @@ router.get("/by-insurance-id", async (req: Request, res: Response): Promise if (patient) { return res.status(200).json(patient); } else { - return res.status(404).json(null); + return res.status(200).json(null); } } catch (err) { console.error("Failed to lookup patient:", err); diff --git a/apps/Frontend/src/pages/claims-page.tsx b/apps/Frontend/src/pages/claims-page.tsx index ce220b7..2ae05bf 100644 --- a/apps/Frontend/src/pages/claims-page.tsx +++ b/apps/Frontend/src/pages/claims-page.tsx @@ -155,8 +155,14 @@ export default function ClaimsPage() { "GET", `/api/patients/by-insurance-id?insuranceId=${encodeURIComponent(insuranceId)}` ); - if (!res.ok) throw new Error("Failed to fetch patient by insuranceId"); - return res.json(); // returns patient object or null + + if (!res.ok) { + throw new Error( + `Failed to fetch patient by insuranceId (status ${res.status})` + ); + } + + return res.json(); }; // workflow starts from there - this params are set by pdf extraction/patient page. then used in claim page here.