fixed fetchingMatchingPatient

This commit is contained in:
2025-08-23 23:21:55 +05:30
parent f76afc43ab
commit d8ee9da6f9
2 changed files with 9 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ router.get("/by-insurance-id", async (req: Request, res: Response): Promise<any>
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);

View File

@@ -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.