refactor(actions): complete case read migration to endpoint client

This commit is contained in:
2026-03-25 07:52:51 +00:00
parent 353378ee45
commit ad3b18ac27
2 changed files with 51 additions and 31 deletions
+18 -31
View File
@@ -235,27 +235,19 @@ export const patchCase = async (incidentid) => {
};
export const getCase = (incidentID) => {
return axios
.get(BASE_URL + "/api/endpoint/getcase_api?incidentID=" + incidentID)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
return getJson(
BASE_URL + "/api/endpoint/getcase_api?incidentID=" + incidentID
).catch((error) => {
consoleLogger(error);
});
};
export const getCaseByID = (incidentID) => {
return axios
.get(
BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
return getJson(
BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID
).catch((error) => {
consoleLogger(error);
});
};
export const getAppealPDFDocs = (incidentID) => {
@@ -269,19 +261,14 @@ export const getAppealPDFDocs = (incidentID) => {
};
export const getAppealPDFDocument = async (incidentid) => {
return axios
.get(
BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
incidentid
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
return error.response;
});
return getJson(
BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
incidentid
).catch((error) => {
consoleLogger(error);
return error.response;
});
};
export const getPortalModuleDetails = async (appealType, caseReference) => {
+33
View File
@@ -1765,3 +1765,36 @@ Validation:
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.
---
### CL-049: TASK22260 next slice — case direct service remaining GET helper migration
date: 2026-03-25
author: Cline
scope: `actions/services/caseDirectService.js`
type: change
rationale: Complete the remaining safe GET-helper client migration in case service by moving custom-catch read functions to `getJson` while preserving their existing return-shape/error handling behavior.
impact: Removes remaining direct axios GET response-extraction boilerplate in case read helpers and completes endpointClient read-path consistency for this service subset.
status: completed
Summary:
- Migrated remaining targeted case read helpers from direct `axios.get(...).then(res.data)` to `getJson(...)`:
- `getCase`
- `getCaseByID`
- `getAppealPDFDocument`
- Preserved behavior contracts:
- unchanged request URL/query construction
- unchanged catch semantics:
- `getCase` / `getCaseByID` still log via `consoleLogger`
- `getAppealPDFDocument` still logs and returns `error.response` on failure
- left non-targeted POST/update/create/patch flows unchanged.
Validation:
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next bounded slice: evaluate config-based POST helpers in `caseDirectService` (`createNewCase`, `createNewCaseBlob`, `updateCase`, `updateCaseBlob`) for selective `requestJson(...)` adoption while preserving existing side effects and error contracts.