refactor(actions): adopt endpoint client in document service posts
This commit is contained in:
@@ -3,7 +3,7 @@ import { BASE_URL } from "../core/env";
|
||||
import { consoleLogger } from "../core/logger";
|
||||
import { hashAPIPath } from "../core/hash";
|
||||
import { buildHashedQueryUrl } from "../clients/relayClient";
|
||||
import { getJson } from "../clients/endpointClient";
|
||||
import { getJson, requestJson } from "../clients/endpointClient";
|
||||
|
||||
export const getAwaitingSubmissionFromBlob = (containerName) => {
|
||||
return axios
|
||||
@@ -153,8 +153,7 @@ export const uploadFiles = async (
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
@@ -183,8 +182,7 @@ export const uploadSingleFile = async (filesObj, containerID, casefolderID) => {
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
@@ -214,8 +212,7 @@ export const uploadRepFiles = async (
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
@@ -240,8 +237,7 @@ export const generateRepPDF = async (
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
@@ -274,8 +270,7 @@ export const generateAppealPDF = async (
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
return await requestJson(config);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
|
||||
@@ -1634,3 +1634,38 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Optional next bounded slice: migrate selected `requestJson`-eligible upload/generation helpers in `documentDirectService` (non-download paths) while preserving multipart/blob behavior.
|
||||
|
||||
---
|
||||
|
||||
### CL-045: TASK22260 next slice — document direct service requestJson adoption (uploads + PDF generation)
|
||||
|
||||
date: 2026-03-25
|
||||
author: Cline
|
||||
scope: `actions/services/documentDirectService.js`
|
||||
type: change
|
||||
rationale: Continue bounded client migration by moving config-based multipart/PDF POST helpers in document service to shared `requestJson` while preserving hashed URL generation and responseType behavior.
|
||||
impact: Reduces repeated axios config execution boilerplate and aligns document POST helper internals with shared endpoint client conventions.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated selected config-based document helper flows from `axios(config)` + `res.data` to `requestJson(config)`:
|
||||
- `uploadFiles`
|
||||
- `uploadSingleFile`
|
||||
- `uploadRepFiles`
|
||||
- `generateRepPDF`
|
||||
- `generateAppealPDF`
|
||||
- Preserved behavior-critical aspects:
|
||||
- hashed URL creation via `buildHashedQueryUrl(...)`
|
||||
- multipart headers for upload flows
|
||||
- conditional `responseType: "blob"` for download PDF option paths
|
||||
- existing catch-path logging semantics
|
||||
- Left delete/download/hash-sensitive GET helpers unchanged in this slice.
|
||||
|
||||
Validation:
|
||||
|
||||
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Optional next bounded slice: evaluate remaining legacy direct `axios.get(...).then(res.data)` helpers in `documentDirectService` (`getAwaitingSubmissionFromBlob`, `getRepsFromBlob`, `getFilesFromBlob`) for safe migration while preserving signed hash path behavior.
|
||||
|
||||
Reference in New Issue
Block a user