updated serching to reduce CRM calls for performance and stability

This commit is contained in:
2025-10-28 11:21:38 +00:00
parent df199cff53
commit e54a0b2253
12 changed files with 265 additions and 164 deletions
+22 -15
View File
@@ -532,23 +532,30 @@ export const getBasicSearchDetailsPaged = async (
appealTypeName,
caseReference,
primaryIdAttribute,
incidentID
incidentIDs
) => {
//console.log("check appealtype:", appealType, caseReference);
if (!incidentIDs || incidentIDs.length === 0) return [];
return axios
.get(
"/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" +
appealTypeName +
"&primaryIdAttribute=" +
primaryIdAttribute +
"&incidentID=" +
incidentID
)
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
});
// Build OData filter correctly
const filter = incidentIDs
.map((id) => `_${primaryIdAttribute}s_value eq ${id}`)
.join(" or ");
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
filter
)}`;
// console.log(
// `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
// );
try {
const res = await axios.get(url);
return res.data.value || []; // ensure returning an array
} catch (error) {
consoleLogger(error);
return [];
}
};
export const getSearchDocumentDetails = (incidentID) => {