From ad3b18ac278a950e891476ce371cfcd181760015 Mon Sep 17 00:00:00 2001 From: robbond Date: Wed, 25 Mar 2026 07:52:51 +0000 Subject: [PATCH] refactor(actions): complete case read migration to endpoint client --- actions/services/caseDirectService.js | 49 ++++++++++----------------- memory-bank/change-log.md | 33 ++++++++++++++++++ 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/actions/services/caseDirectService.js b/actions/services/caseDirectService.js index d40332f9..18d0827f 100644 --- a/actions/services/caseDirectService.js +++ b/actions/services/caseDirectService.js @@ -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) => { diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index 7c64b699..a9b271aa 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -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.