refactor(actions): reduce remaining axios usage in document service
This commit is contained in:
@@ -71,14 +71,11 @@ export const deleteAwaitingSubmissionsFromBlob = (
|
|||||||
|
|
||||||
return buildHashedQueryUrl(queryUrl)
|
return buildHashedQueryUrl(queryUrl)
|
||||||
.then((signedUrl) =>
|
.then((signedUrl) =>
|
||||||
axios({
|
requestJson({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: signedUrl
|
url: signedUrl
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
});
|
});
|
||||||
@@ -99,14 +96,11 @@ export const deleteMyRepresentationsFromBlob = (
|
|||||||
|
|
||||||
return buildHashedQueryUrl(queryUrl)
|
return buildHashedQueryUrl(queryUrl)
|
||||||
.then((signedUrl) =>
|
.then((signedUrl) =>
|
||||||
axios({
|
requestJson({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: signedUrl
|
url: signedUrl
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
});
|
});
|
||||||
@@ -306,20 +300,17 @@ export const deleteBlob = async (
|
|||||||
deleteblobhash,
|
deleteblobhash,
|
||||||
casefolderID
|
casefolderID
|
||||||
) => {
|
) => {
|
||||||
try {
|
return getJson(
|
||||||
const res = await axios.get(
|
"/api/file/deleteblob?container=" +
|
||||||
"/api/file/deleteblob?container=" +
|
containerName +
|
||||||
containerName +
|
"&casefolderID=" +
|
||||||
"&casefolderID=" +
|
encodeURIComponent(casefolderID) +
|
||||||
encodeURIComponent(casefolderID) +
|
"&blobname=" +
|
||||||
"&blobname=" +
|
encodeURIComponent(blobName) +
|
||||||
encodeURIComponent(blobName) +
|
deleteblobhash
|
||||||
deleteblobhash
|
).catch((error) => {
|
||||||
);
|
|
||||||
return res.data;
|
|
||||||
} catch (error) {
|
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteRepBlob = async (
|
export const deleteRepBlob = async (
|
||||||
@@ -329,20 +320,17 @@ export const deleteRepBlob = async (
|
|||||||
casefolderID,
|
casefolderID,
|
||||||
filenamePrefix
|
filenamePrefix
|
||||||
) => {
|
) => {
|
||||||
try {
|
return getJson(
|
||||||
const res = await axios.get(
|
"/api/file/deleteblob?container=" +
|
||||||
"/api/file/deleteblob?container=" +
|
containerName +
|
||||||
containerName +
|
"&casefolderID=" +
|
||||||
"&casefolderID=" +
|
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
|
||||||
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
|
"&blobname=" +
|
||||||
"&blobname=" +
|
encodeURIComponent(blobName) +
|
||||||
encodeURIComponent(blobName) +
|
deleteblobhash
|
||||||
deleteblobhash
|
).catch((error) => {
|
||||||
);
|
|
||||||
return res.data;
|
|
||||||
} catch (error) {
|
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const downloadBlob = (containerName, blobName) => {
|
export const downloadBlob = (containerName, blobName) => {
|
||||||
|
|||||||
@@ -1958,3 +1958,36 @@ Validation:
|
|||||||
Follow-ups:
|
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.
|
- 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user