refactor(actions): expand endpoint client adoption in case reads

This commit is contained in:
2026-03-25 07:45:51 +00:00
parent c1f6cc9832
commit 353378ee45
2 changed files with 56 additions and 46 deletions
+22 -46
View File
@@ -5,67 +5,43 @@ import { logAndReturnResponse } from "./httpServiceUtils";
import { getJson } from "../clients/endpointClient";
export const getCaseMessage = (searchString) => {
return axios
.get(BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString
).catch(logAndReturnResponse);
};
export const getIncidentbyID = (searchString) => {
return axios
.get(
BASE_URL +
"/api/endpoint/getincidentbyid_api?searchString=" +
searchString
)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
BASE_URL +
"/api/endpoint/getincidentbyid_api?searchString=" +
searchString
).catch(logAndReturnResponse);
};
export const getIsPublishedbyID = (searchString) => {
return axios
.get(
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString
)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString
).catch(logAndReturnResponse);
};
export const getPartSavedAppeal = (searchString) => {
return axios
.get(
BASE_URL +
"/api/endpoint/getpartsavedappeal_api?searchString=" +
searchString
)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
BASE_URL +
"/api/endpoint/getpartsavedappeal_api?searchString=" +
searchString
).catch(logAndReturnResponse);
};
export const getSIPSEvents = async (caseid) => {
return axios
.get(BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid
).catch(logAndReturnResponse);
};
export const getSIPSMedia = async (caseid) => {
return axios
.get(BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid)
.then((res) => {
return res.data;
})
.catch(logAndReturnResponse);
return getJson(
BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid
).catch(logAndReturnResponse);
};
export const getAppealID = (
+34
View File
@@ -1731,3 +1731,37 @@ Validation:
Follow-ups:
- Optional next bounded slice: migrate additional safe case service GET helpers that currently use `axios.get(...).then(res.data)` to `getJson` where custom catch behavior is compatible.
---
### CL-048: TASK22260 next slice — case direct service GET cluster expansion
date: 2026-03-25
author: Cline
scope: `actions/services/caseDirectService.js`
type: change
rationale: Continue phased endpoint client adoption by migrating another bounded set of case service GET helpers that already use shared catch handling (`logAndReturnResponse`).
impact: Further reduces duplicated axios GET/response extraction boilerplate while preserving existing error-handling contracts for migrated paths.
status: completed
Summary:
- Migrated additional case retrieval helpers from `axios.get(...).then(res.data)` to `getJson(...)`:
- `getCaseMessage`
- `getIncidentbyID`
- `getIsPublishedbyID`
- `getPartSavedAppeal`
- `getSIPSEvents`
- `getSIPSMedia`
- Preserved behavior contracts:
- unchanged URLs/query parameter composition
- unchanged catch behavior via `logAndReturnResponse`
- left non-targeted/bespoke flows untouched (`getAppealID`, create/update/patch operations, and error-response-specialized helpers)
Validation:
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next bounded slice: evaluate remaining GET helpers in `caseDirectService` with custom catches (`getCase`, `getCaseByID`, `getAppealPDFDocument`) for selective migration where return-shape contracts remain stable.