From 353378ee45719b26af6b1bbc9e7e82d114d4165f Mon Sep 17 00:00:00 2001 From: robbond Date: Wed, 25 Mar 2026 07:45:51 +0000 Subject: [PATCH] refactor(actions): expand endpoint client adoption in case reads --- actions/services/caseDirectService.js | 68 +++++++++------------------ memory-bank/change-log.md | 34 ++++++++++++++ 2 files changed, 56 insertions(+), 46 deletions(-) diff --git a/actions/services/caseDirectService.js b/actions/services/caseDirectService.js index 206f6125..d40332f9 100644 --- a/actions/services/caseDirectService.js +++ b/actions/services/caseDirectService.js @@ -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 = ( diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index e59d3409..7c64b699 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -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.