refactor(actions): adopt endpoint client in document service reads
This commit is contained in:
@@ -3,6 +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";
|
||||
|
||||
export const getAwaitingSubmissionFromBlob = (containerName) => {
|
||||
return axios
|
||||
@@ -40,27 +41,32 @@ export const getRepsFromBlob = (containerName) => {
|
||||
};
|
||||
|
||||
export const getRepsFromBlobProxy = async (containerName) => {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
"/api/file/getrepsblobproxy?container=" + containerName
|
||||
);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
return getJson(
|
||||
"/api/file/getrepsblobproxy?container=" + containerName
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
||||
containerName
|
||||
);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
||||
containerName
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
|
||||
return getJson(
|
||||
"/api/file/getbloblistproxy?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAwaitingSubmissionsFromBlob = (
|
||||
@@ -298,41 +304,20 @@ export const getFilesFromBlob = (containerName, casefolderID) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/file/getbloblistproxy?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getFilesFromBlobHashed = (
|
||||
containerName,
|
||||
getblobshash,
|
||||
casefolderID
|
||||
) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/file/getbloblist?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
getblobshash
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
return getJson(
|
||||
"/api/file/getbloblist?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
getblobshash
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBlob = async (
|
||||
@@ -404,24 +389,21 @@ export const downloadBlob = (containerName, blobName) => {
|
||||
};
|
||||
|
||||
export const getProgressFromBlob = async (containerName, casereference) => {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
BASE_URL +
|
||||
return getJson(
|
||||
BASE_URL +
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
encodeURIComponent(casereference) +
|
||||
hashAPIPath(
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
encodeURIComponent(casereference) +
|
||||
hashAPIPath(
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
encodeURIComponent(casereference)
|
||||
)
|
||||
);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
encodeURIComponent(casereference)
|
||||
)
|
||||
).catch((error) => {
|
||||
consoleLogger(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const createContainerProxy = (containerName) => {
|
||||
@@ -430,12 +412,9 @@ export const createContainerProxy = (containerName) => {
|
||||
containerName +
|
||||
hashAPIPath("/api/file/setupcontainer?ident=" + containerName);
|
||||
|
||||
return axios
|
||||
.get(BASE_URL + queryUrl)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return getJson(BASE_URL + queryUrl).catch((error) => {
|
||||
consoleLogger(error);
|
||||
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
return JSON.stringify(error);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user