diff --git a/actions/services/caseDirectService.js b/actions/services/caseDirectService.js index 18d0827f..3b03a061 100644 --- a/actions/services/caseDirectService.js +++ b/actions/services/caseDirectService.js @@ -2,7 +2,7 @@ import axios from "axios"; import { BASE_URL } from "../core/env"; import { consoleLogger } from "../core/logger"; import { logAndReturnResponse } from "./httpServiceUtils"; -import { getJson } from "../clients/endpointClient"; +import { getJson, requestJson } from "../clients/endpointClient"; export const getCaseMessage = (searchString) => { return getJson( @@ -97,13 +97,9 @@ export const createNewCase = ( data: data }; - return axios(config) - .then((res) => { - return res.data; - }) - .catch((error) => { - consoleLogger(error); - }); + return requestJson(config).catch((error) => { + consoleLogger(error); + }); }; export const createNewCaseBlob = ( @@ -137,13 +133,9 @@ export const createNewCaseBlob = ( data: data }; - return axios(config) - .then((res) => { - return res.data; - }) - .catch((error) => { - consoleLogger(error); - }); + return requestJson(config).catch((error) => { + consoleLogger(error); + }); }; export const updateCase = async ( @@ -173,13 +165,9 @@ export const updateCase = async ( data: updateBody }; - return axios(config) - .then((res) => { - return res.data; - }) - .catch((error) => { - consoleLogger(error); - }); + return requestJson(config).catch((error) => { + consoleLogger(error); + }); }; export const updateCaseBlob = async ( @@ -209,13 +197,9 @@ export const updateCaseBlob = async ( data: updateBody }; - return axios(config) - .then((res) => { - return res.data; - }) - .catch((error) => { - consoleLogger(error); - }); + return requestJson(config).catch((error) => { + consoleLogger(error); + }); }; export const patchCase = async (incidentid) => { diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index a9b271aa..2f5ee36a 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -1798,3 +1798,35 @@ Validation: 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. + +--- + +### CL-050: TASK22260 next slice — case direct service POST helper requestJson adoption + +date: 2026-03-25 +author: Cline +scope: `actions/services/caseDirectService.js` +type: change +rationale: Continue bounded client-layer migration by moving config-based case service POST helpers from direct `axios(config)` usage to shared `requestJson(...)` while preserving current behavior and error semantics. +impact: Reduces duplicated config-execution/response-extraction boilerplate and aligns case service write-helper internals with existing endpoint client conventions. +status: completed + +Summary: + +- Migrated selected case service POST helpers to `requestJson(config)`: + - `createNewCase` + - `createNewCaseBlob` + - `updateCase` + - `updateCaseBlob` +- Preserved behavior contracts: + - unchanged payload/query construction and URLs + - unchanged catch-path logging via `consoleLogger` + - no changes to non-targeted helper logic (`getAppealID`, `patchCase`, and already-migrated GET helpers) + +Validation: + +- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors) + +Follow-ups: + +- Optional next bounded slice: assess `patchCase` and `getAppealID` for migration opportunities (if/when preserving their specific behavior contracts remains straightforward).