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 { 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";
|
||||||
|
|
||||||
export const getCaseMessage = (searchString) => {
|
export const getCaseMessage = (searchString) => {
|
||||||
return axios
|
return axios
|
||||||
@@ -282,16 +283,13 @@ export const getCaseByID = (incidentID) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealPDFDocs = (incidentID) => {
|
export const getAppealPDFDocs = (incidentID) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
BASE_URL +
|
||||||
BASE_URL +
|
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
||||||
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
incidentID
|
||||||
incidentID
|
).catch((error) => {
|
||||||
)
|
consoleLogger(error);
|
||||||
.then((res) => res.data)
|
});
|
||||||
.catch((error) => {
|
|
||||||
consoleLogger(error);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealPDFDocument = async (incidentid) => {
|
export const getAppealPDFDocument = async (incidentid) => {
|
||||||
@@ -311,34 +309,24 @@ export const getAppealPDFDocument = async (incidentid) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getPortalModuleDetails = async (appealType, caseReference) => {
|
export const getPortalModuleDetails = async (appealType, caseReference) => {
|
||||||
var config = {
|
return getJson(
|
||||||
method: "get",
|
BASE_URL +
|
||||||
url:
|
|
||||||
BASE_URL +
|
|
||||||
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
||||||
appealType +
|
appealType +
|
||||||
"&caseReference=" +
|
"&caseReference=" +
|
||||||
encodeURI(caseReference)
|
encodeURI(caseReference)
|
||||||
};
|
).catch((error) => {
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await axios(config);
|
|
||||||
return res.data;
|
|
||||||
} catch (error) {
|
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
||||||
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
appealType +
|
||||||
appealType +
|
"&caseReference=" +
|
||||||
"&caseReference=" +
|
caseReference.replace(/\'/g, "''")
|
||||||
caseReference.replace(/\'/g, "''")
|
).catch((error) => {
|
||||||
)
|
consoleLogger(error);
|
||||||
.then((res) => res.data)
|
});
|
||||||
.catch((error) => {
|
|
||||||
consoleLogger(error);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1700,3 +1700,34 @@ Validation:
|
|||||||
Follow-ups:
|
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.
|
- 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