refactor(actions): reduce remaining axios usage in document service

This commit is contained in:
2026-03-25 09:52:27 +00:00
parent ba7d94d83d
commit 4a49bbca09
2 changed files with 55 additions and 34 deletions
+22 -34
View File
@@ -71,14 +71,11 @@ export const deleteAwaitingSubmissionsFromBlob = (
return buildHashedQueryUrl(queryUrl)
.then((signedUrl) =>
axios({
requestJson({
method: "get",
url: signedUrl
})
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
@@ -99,14 +96,11 @@ export const deleteMyRepresentationsFromBlob = (
return buildHashedQueryUrl(queryUrl)
.then((signedUrl) =>
axios({
requestJson({
method: "get",
url: signedUrl
})
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
@@ -306,20 +300,17 @@ export const deleteBlob = async (
deleteblobhash,
casefolderID
) => {
try {
const res = await axios.get(
"/api/file/deleteblob?container=" +
containerName +
"&casefolderID=" +
encodeURIComponent(casefolderID) +
"&blobname=" +
encodeURIComponent(blobName) +
deleteblobhash
);
return res.data;
} catch (error) {
return getJson(
"/api/file/deleteblob?container=" +
containerName +
"&casefolderID=" +
encodeURIComponent(casefolderID) +
"&blobname=" +
encodeURIComponent(blobName) +
deleteblobhash
).catch((error) => {
consoleLogger(error);
}
});
};
export const deleteRepBlob = async (
@@ -329,20 +320,17 @@ export const deleteRepBlob = async (
casefolderID,
filenamePrefix
) => {
try {
const res = await axios.get(
"/api/file/deleteblob?container=" +
containerName +
"&casefolderID=" +
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
"&blobname=" +
encodeURIComponent(blobName) +
deleteblobhash
);
return res.data;
} catch (error) {
return getJson(
"/api/file/deleteblob?container=" +
containerName +
"&casefolderID=" +
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
"&blobname=" +
encodeURIComponent(blobName) +
deleteblobhash
).catch((error) => {
consoleLogger(error);
}
});
};
export const downloadBlob = (containerName, blobName) => {
+33
View File
@@ -1958,3 +1958,36 @@ Validation:
Follow-ups:
- Optional next bounded slice: assess whether a dedicated signed-request client helper should encapsulate hash + headers + method conventions to prevent future drift in remaining signed flows.
---
### CL-055: TASK22260 next slice — document direct service signed/delete axios reduction
date: 2026-03-25
author: Cline
scope: `actions/services/documentDirectService.js`
type: change
rationale: Execute next bounded risk-reduction slice by migrating remaining non-download document-service delete and signed-get helper calls away from direct axios response extraction to shared endpoint clients.
impact: Further reduces duplicated axios boilerplate and aligns document service internals with shared request-client conventions while preserving existing hash/query and catch-path behavior.
status: completed
Summary:
- Migrated signed hashed delete-helper flows from direct `axios({...}).then(res.data)` to `requestJson({...})`:
- `deleteAwaitingSubmissionsFromBlob`
- `deleteMyRepresentationsFromBlob`
- Migrated delete helper GET calls from `axios.get(...).then(res.data)` to `getJson(...)`:
- `deleteBlob`
- `deleteRepBlob`
- Preserved behavior contracts:
- unchanged query/hash composition and endpoint URLs
- unchanged catch-path logging with `consoleLogger`
- Left `downloadBlob` unchanged in this slice (special-case behavior path retained for separate focused handling).
Validation:
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next bounded slice: isolate and correct `downloadBlob` behavior in `documentDirectService` (including legacy `res` usage) behind an explicit, tested contract.