refactor(actions): adopt endpoint client in case service posts

This commit is contained in:
2026-03-25 08:00:14 +00:00
parent ad3b18ac27
commit 9d67079fb0
2 changed files with 45 additions and 29 deletions
+13 -29
View File
@@ -2,7 +2,7 @@ import axios from "axios";
import { BASE_URL } from "../core/env"; import { BASE_URL } from "../core/env";
import { consoleLogger } from "../core/logger"; import { consoleLogger } from "../core/logger";
import { logAndReturnResponse } from "./httpServiceUtils"; import { logAndReturnResponse } from "./httpServiceUtils";
import { getJson } from "../clients/endpointClient"; import { getJson, requestJson } from "../clients/endpointClient";
export const getCaseMessage = (searchString) => { export const getCaseMessage = (searchString) => {
return getJson( return getJson(
@@ -97,13 +97,9 @@ export const createNewCase = (
data: data data: data
}; };
return axios(config) return requestJson(config).catch((error) => {
.then((res) => { consoleLogger(error);
return res.data; });
})
.catch((error) => {
consoleLogger(error);
});
}; };
export const createNewCaseBlob = ( export const createNewCaseBlob = (
@@ -137,13 +133,9 @@ export const createNewCaseBlob = (
data: data data: data
}; };
return axios(config) return requestJson(config).catch((error) => {
.then((res) => { consoleLogger(error);
return res.data; });
})
.catch((error) => {
consoleLogger(error);
});
}; };
export const updateCase = async ( export const updateCase = async (
@@ -173,13 +165,9 @@ export const updateCase = async (
data: updateBody data: updateBody
}; };
return axios(config) return requestJson(config).catch((error) => {
.then((res) => { consoleLogger(error);
return res.data; });
})
.catch((error) => {
consoleLogger(error);
});
}; };
export const updateCaseBlob = async ( export const updateCaseBlob = async (
@@ -209,13 +197,9 @@ export const updateCaseBlob = async (
data: updateBody data: updateBody
}; };
return axios(config) return requestJson(config).catch((error) => {
.then((res) => { consoleLogger(error);
return res.data; });
})
.catch((error) => {
consoleLogger(error);
});
}; };
export const patchCase = async (incidentid) => { export const patchCase = async (incidentid) => {
+32
View File
@@ -1798,3 +1798,35 @@ Validation:
Follow-ups: 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. - 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).