refactor(actions): expand endpoint client adoption in case reads
This commit is contained in:
@@ -5,67 +5,43 @@ import { logAndReturnResponse } from "./httpServiceUtils";
|
|||||||
import { getJson } from "../clients/endpointClient";
|
import { getJson } from "../clients/endpointClient";
|
||||||
|
|
||||||
export const getCaseMessage = (searchString) => {
|
export const getCaseMessage = (searchString) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString)
|
BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString
|
||||||
.then((res) => {
|
).catch(logAndReturnResponse);
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getIncidentbyID = (searchString) => {
|
export const getIncidentbyID = (searchString) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
BASE_URL +
|
||||||
BASE_URL +
|
"/api/endpoint/getincidentbyid_api?searchString=" +
|
||||||
"/api/endpoint/getincidentbyid_api?searchString=" +
|
searchString
|
||||||
searchString
|
).catch(logAndReturnResponse);
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getIsPublishedbyID = (searchString) => {
|
export const getIsPublishedbyID = (searchString) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString
|
||||||
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString
|
).catch(logAndReturnResponse);
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPartSavedAppeal = (searchString) => {
|
export const getPartSavedAppeal = (searchString) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
BASE_URL +
|
||||||
BASE_URL +
|
"/api/endpoint/getpartsavedappeal_api?searchString=" +
|
||||||
"/api/endpoint/getpartsavedappeal_api?searchString=" +
|
searchString
|
||||||
searchString
|
).catch(logAndReturnResponse);
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSIPSEvents = async (caseid) => {
|
export const getSIPSEvents = async (caseid) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid)
|
BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid
|
||||||
.then((res) => {
|
).catch(logAndReturnResponse);
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSIPSMedia = async (caseid) => {
|
export const getSIPSMedia = async (caseid) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid)
|
BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid
|
||||||
.then((res) => {
|
).catch(logAndReturnResponse);
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch(logAndReturnResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealID = (
|
export const getAppealID = (
|
||||||
|
|||||||
@@ -1731,3 +1731,37 @@ Validation:
|
|||||||
Follow-ups:
|
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.
|
- 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user