refactor(actions): adopt endpoint client in case service reads
This commit is contained in:
@@ -2,6 +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";
|
||||
|
||||
export const getCaseMessage = (searchString) => {
|
||||
return axios
|
||||
@@ -282,16 +283,13 @@ export const getCaseByID = (incidentID) => {
|
||||
};
|
||||
|
||||
export const getAppealPDFDocs = (incidentID) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
||||
incidentID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealPDFDocument = async (incidentid) => {
|
||||
@@ -311,34 +309,24 @@ export const getAppealPDFDocument = async (incidentid) => {
|
||||
};
|
||||
|
||||
export const getPortalModuleDetails = async (appealType, caseReference) => {
|
||||
var config = {
|
||||
method: "get",
|
||||
url:
|
||||
BASE_URL +
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
encodeURI(caseReference)
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
caseReference.replace(/\'/g, "''")
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
return getJson(
|
||||
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
caseReference.replace(/\'/g, "''")
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1700,3 +1700,34 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Optional next bounded slice: targeted hygiene in `documentDirectService` to isolate remaining non-migrated special-case flows (`downloadBlob`, delete helpers) and assess if any shared client abstraction is beneficial without altering behavior.
|
||||
|
||||
---
|
||||
|
||||
### CL-047: TASK22260 next slice — case direct service low-risk getJson adoption
|
||||
|
||||
date: 2026-03-25
|
||||
author: Cline
|
||||
scope: `actions/services/caseDirectService.js`
|
||||
type: change
|
||||
rationale: Continue incremental endpoint client rollout with a bounded low-risk set of case service GET helpers that already return direct JSON payloads and have simple logging-only catch paths.
|
||||
impact: Reduces repeated axios GET/response extraction boilerplate and aligns additional case retrieval helpers with shared client conventions.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added `getJson` usage in selected `caseDirectService` helper functions:
|
||||
- `getAppealPDFDocs`
|
||||
- `getPortalModuleDetails`
|
||||
- `getPortalModuleDetailsProxy`
|
||||
- Preserved existing behavior contracts:
|
||||
- same request URL/query construction
|
||||
- same catch-path logging via `consoleLogger`
|
||||
- no change to handlers with bespoke error-return contracts (`getAppealPDFDocument`) or other non-targeted flows.
|
||||
|
||||
Validation:
|
||||
|
||||
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user