refactor(actions): remove remaining axios usage in case service
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
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";
|
||||||
@@ -49,17 +48,16 @@ export const getAppealID = (
|
|||||||
updateFormCollection,
|
updateFormCollection,
|
||||||
primaryAttribute
|
primaryAttribute
|
||||||
) => {
|
) => {
|
||||||
return axios
|
return getJson(
|
||||||
.get(
|
"/api/endpoint/getappealid_api?updateFormCollection=" +
|
||||||
"/api/endpoint/getappealid_api?updateFormCollection=" +
|
updateFormCollection +
|
||||||
updateFormCollection +
|
"&primaryAttribute=" +
|
||||||
"&primaryAttribute=" +
|
primaryAttribute +
|
||||||
primaryAttribute +
|
"&caseReference=" +
|
||||||
"&caseReference=" +
|
caseReference
|
||||||
caseReference
|
)
|
||||||
)
|
.then((data) => {
|
||||||
.then((res) => {
|
const result = Object.entries(data.value[0]).filter(
|
||||||
const result = Object.entries(res.data.value[0]).filter(
|
|
||||||
([key]) => !key.startsWith("_")
|
([key]) => !key.startsWith("_")
|
||||||
)[0][1];
|
)[0][1];
|
||||||
var appealID = result;
|
var appealID = result;
|
||||||
@@ -204,18 +202,9 @@ export const updateCaseBlob = async (
|
|||||||
|
|
||||||
export const patchCase = async (incidentid) => {
|
export const patchCase = async (incidentid) => {
|
||||||
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
|
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
|
||||||
var config = {
|
return getJson(queryUrl).catch((error) => {
|
||||||
method: "get",
|
//console.log("this error:", error);
|
||||||
url: queryUrl
|
});
|
||||||
};
|
|
||||||
|
|
||||||
return axios(config)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
//console.log("this error:", error);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCase = (incidentID) => {
|
export const getCase = (incidentID) => {
|
||||||
|
|||||||
@@ -1830,3 +1830,33 @@ Validation:
|
|||||||
Follow-ups:
|
Follow-ups:
|
||||||
|
|
||||||
- Optional next bounded slice: assess `patchCase` and `getAppealID` for migration opportunities (if/when preserving their specific behavior contracts remains straightforward).
|
- Optional next bounded slice: assess `patchCase` and `getAppealID` for migration opportunities (if/when preserving their specific behavior contracts remains straightforward).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### CL-051: TASK22260 next slice — case direct service final axios dependency removal
|
||||||
|
|
||||||
|
date: 2026-03-25
|
||||||
|
author: Cline
|
||||||
|
scope: `actions/services/caseDirectService.js`
|
||||||
|
type: change
|
||||||
|
rationale: Complete the bounded case service migration by replacing the remaining direct axios usage (`getAppealID`, `patchCase`) with shared endpoint client reads, enabling removal of the direct axios import.
|
||||||
|
impact: Finalizes endpoint client consistency in case service and removes remaining direct axios dependency from this module without changing helper contracts.
|
||||||
|
status: completed
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
|
||||||
|
- Migrated remaining direct axios-based read helpers to `getJson(...)`:
|
||||||
|
- `getAppealID`
|
||||||
|
- `patchCase`
|
||||||
|
- Preserved behavior contracts:
|
||||||
|
- `getAppealID` still extracts first non-underscore key value from returned entity and logs on failure
|
||||||
|
- `patchCase` still swallows failure (no explicit returned error contract introduced)
|
||||||
|
- Removed now-unused `axios` import from `caseDirectService`.
|
||||||
|
|
||||||
|
Validation:
|
||||||
|
|
||||||
|
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||||
|
|
||||||
|
Follow-ups:
|
||||||
|
|
||||||
|
- Optional next bounded slice: review other direct service modules for any remaining legacy `axios` import usage now that case service migration is complete.
|
||||||
|
|||||||
Reference in New Issue
Block a user