21256 mocked api response

This commit is contained in:
2026-02-04 11:20:29 +00:00
parent dc8958f7a1
commit 3bd1e7e7fe
4 changed files with 266 additions and 90 deletions
+103 -90
View File
@@ -34,7 +34,7 @@ export const getIP = (req) => {
console.info( console.info(
"\n====================\n Client IP address: " + ip, "\n====================\n Client IP address: " + ip,
"\n=====================\n" "\n=====================\n",
); );
}; };
@@ -42,7 +42,7 @@ export const consoleLogger = (err) => {
console.log( console.log(
"\n\n/////////////////////////////////////////////////\nRaw Error " + "\n\n/////////////////////////////////////////////////\nRaw Error " +
err + err +
"\n\n/////////////////////////////////////////////////\n" "\n\n/////////////////////////////////////////////////\n",
); );
var errStr = var errStr =
"\n\n/////////////////////////////////////////////////\nServer Error " + "\n\n/////////////////////////////////////////////////\nServer Error " +
@@ -102,7 +102,7 @@ export const getToken = () => {
.post( .post(
`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`, `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
tokenBody, tokenBody,
tokenConfig tokenConfig,
) )
.then((res) => res.data) .then((res) => res.data)
.then((data) => { .then((data) => {
@@ -191,7 +191,7 @@ export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
export const hashAPIPath = (queryPath) => { export const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256( var hashlink = CryptoJS.HmacSHA256(
queryPath, queryPath,
CryptoJS.enc.Hex.parse(WORDKEY) CryptoJS.enc.Hex.parse(WORDKEY),
); );
hashlink = hashlink.toString(CryptoJS.enc.Hex); hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
@@ -216,7 +216,7 @@ export const getBasicSearch = (searchString) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getbasicsearch_api?searchString=" + "/api/endpoint/getbasicsearch_api?searchString=" +
searchString searchString,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -244,7 +244,7 @@ export const getIncidentbyID = (searchString) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getincidentbyid_api?searchString=" + "/api/endpoint/getincidentbyid_api?searchString=" +
searchString searchString,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -258,7 +258,7 @@ export const getIncidentbyID = (searchString) => {
export const getIsPublishedbyID = (searchString) => { export const getIsPublishedbyID = (searchString) => {
return axios return axios
.get( .get(
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString "/api/endpoint/getispublishedbyid_api?searchString=" + searchString,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -274,7 +274,7 @@ export const getPartSavedAppeal = (searchString) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getpartsavedappeal_api?searchString=" + "/api/endpoint/getpartsavedappeal_api?searchString=" +
searchString searchString,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -290,7 +290,7 @@ export const getBasicDNSURLSearch = (searchString) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getbasicdnsurlsearch_api?searchString=" + "/api/endpoint/getbasicdnsurlsearch_api?searchString=" +
searchString searchString,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -313,12 +313,24 @@ export const getSIPSEvents = async (caseid) => {
}); });
}; };
export const getSIPSMedia = async (caseid) => {
return axios
.get(BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
return error.response;
});
};
export const getAddressSearchPaged = ( export const getAddressSearchPaged = (
searchString, searchString,
pageNumber, pageNumber,
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords showNumberOfRecords,
) => { ) => {
return axios return axios
.get( .get(
@@ -331,7 +343,7 @@ export const getAddressSearchPaged = (
"&fieldSort=" + "&fieldSort=" +
fieldSort + fieldSort +
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords showNumberOfRecords,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -347,7 +359,7 @@ export const getBasicSearchPaged = (
pageNumber, pageNumber,
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords showNumberOfRecords,
) => { ) => {
return axios return axios
.get( .get(
@@ -360,7 +372,7 @@ export const getBasicSearchPaged = (
"&fieldSort=" + "&fieldSort=" +
fieldSort + fieldSort +
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords showNumberOfRecords,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -413,7 +425,7 @@ export const getBasicDNSSearchPaged = (
pageNumber, pageNumber,
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords showNumberOfRecords,
) => { ) => {
return axios return axios
.get( .get(
@@ -424,7 +436,7 @@ export const getBasicDNSSearchPaged = (
"&fieldSort=" + "&fieldSort=" +
fieldSort + fieldSort +
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords showNumberOfRecords,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -438,7 +450,7 @@ export const getAdvancedSearch = (searchString) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getadvancedsearch_api?searchstring=" + "/api/endpoint/getadvancedsearch_api?searchstring=" +
JSON.stringify(searchString) JSON.stringify(searchString),
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -458,7 +470,7 @@ export const getAdvancedSearchPaged = (
pageNumber, pageNumber,
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords showNumberOfRecords,
) => { ) => {
return axios return axios
.get( .get(
@@ -471,7 +483,7 @@ export const getAdvancedSearchPaged = (
"&fieldSort=" + "&fieldSort=" +
fieldSort + fieldSort +
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords showNumberOfRecords,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -490,7 +502,7 @@ export const getBasicSearchDetails = async (
appealTypeName, appealTypeName,
caseReference, caseReference,
primaryIdAttribute, primaryIdAttribute,
incidentID incidentID,
) => { ) => {
return axios return axios
.get( .get(
@@ -500,7 +512,7 @@ export const getBasicSearchDetails = async (
"&primaryIdAttribute=" + "&primaryIdAttribute=" +
primaryIdAttribute + primaryIdAttribute +
"&incidentID=" + "&incidentID=" +
incidentID incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -512,7 +524,7 @@ export const getBasicPartSavedDetails = (
appealTypeName, appealTypeName,
caseReference, caseReference,
primaryIdAttribute, primaryIdAttribute,
incidentID incidentID,
) => { ) => {
//console.log( //console.log(
// "///////api call: ", // "///////api call: ",
@@ -532,7 +544,7 @@ export const getBasicPartSavedDetails = (
"&primaryIdAttribute=" + "&primaryIdAttribute=" +
primaryIdAttribute + primaryIdAttribute +
"&incidentID=" + "&incidentID=" +
incidentID incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -544,7 +556,7 @@ export const getBasicSearchDetailsPaged = async (
appealTypeName, appealTypeName,
caseReference, caseReference,
primaryIdAttribute, primaryIdAttribute,
incidentIDs incidentIDs,
) => { ) => {
if (!incidentIDs || incidentIDs.length === 0) return []; if (!incidentIDs || incidentIDs.length === 0) return [];
@@ -566,11 +578,11 @@ export const getBasicSearchDetailsPaged = async (
.join(" or "); .join(" or ");
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent( const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
filter filter,
)}`; )}`;
console.log( console.log(
`Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}` `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`,
); );
try { try {
@@ -586,7 +598,7 @@ export const getSearchDocumentDetails = (incidentID) => {
return axios return axios
.get( .get(
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" + "/api/endpoint/getsearchdocumentdetails_api?incidentid=" +
incidentID incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -598,7 +610,7 @@ export const getSearchDocumentDetails = (incidentID) => {
export const getSearchDocumentTypes = (incidentID) => { export const getSearchDocumentTypes = (incidentID) => {
return axios return axios
.get( .get(
"/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID "/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -611,7 +623,7 @@ export const getAppealPDFDocs = (incidentID) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" + "/api/endpoint/getappealpdfdocuments_api?incidentid=" +
incidentID incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -625,7 +637,7 @@ export const getSearchDocumentDetailsPaged = (
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords, showNumberOfRecords,
documentType documentType,
) => { ) => {
//console.log("to api:", documentType); //console.log("to api:", documentType);
return axios return axios
@@ -641,7 +653,7 @@ export const getSearchDocumentDetailsPaged = (
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords + showNumberOfRecords +
"&documentType=" + "&documentType=" +
documentType documentType,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -653,7 +665,7 @@ export const getLinkedCases = (parentIncidentid) => {
return axios return axios
.get( .get(
"/api/endpoint/getlinkedcases_api?parentincidentid=" + "/api/endpoint/getlinkedcases_api?parentincidentid=" +
parentIncidentid parentIncidentid,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -745,7 +757,7 @@ export const getMandatoryFields = (whichForm) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getmandatoryfields_api?whichForm=" + "/api/endpoint/getmandatoryfields_api?whichForm=" +
whichForm whichForm,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -767,7 +779,7 @@ export const getPersonalAccount = (contactid) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getpersonalaccount_api?contactid=" + "/api/endpoint/getpersonalaccount_api?contactid=" +
contactid contactid,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -787,7 +799,7 @@ export const getPersonalAccount = (contactid) => {
export const getAppealID = ( export const getAppealID = (
caseReference, caseReference,
updateFormCollection, updateFormCollection,
primaryAttribute primaryAttribute,
) => { ) => {
//console.log( //console.log(
// "is this the collection?:", // "is this the collection?:",
@@ -803,11 +815,11 @@ export const getAppealID = (
"&primaryAttribute=" + "&primaryAttribute=" +
primaryAttribute + primaryAttribute +
"&caseReference=" + "&caseReference=" +
caseReference caseReference,
) )
.then((res) => { .then((res) => {
const result = Object.entries(res.data.value[0]).filter( const result = Object.entries(res.data.value[0]).filter(
([key]) => !key.startsWith("_") ([key]) => !key.startsWith("_"),
)[0][1]; )[0][1];
// console.log("result:", res.data); // console.log("result:", res.data);
var appealID = result; var appealID = result;
@@ -824,7 +836,7 @@ export const getLogin = (emailAddress, pwd) => {
"/api/endpoint/getlogin_api?emailAddress=" + "/api/endpoint/getlogin_api?emailAddress=" +
emailAddress + emailAddress +
"&pwd=" + "&pwd=" +
pwd pwd,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -837,7 +849,7 @@ export const getMyCases = (loggedInUserId) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getmycases_api?loggedInUserId=" + "/api/endpoint/getmycases_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -852,7 +864,7 @@ export const getMyInvolvements = async (loggedInUserId) => {
const res = await axios.get( const res = await axios.get(
BASE_URL + BASE_URL +
"/api/endpoint/getmyinvolvements_api?loggedInUserId=" + "/api/endpoint/getmyinvolvements_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
); );
return res.data; return res.data;
} catch (error) { } catch (error) {
@@ -876,7 +888,7 @@ export const getMyRepresentations = (loggedInUserId) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getmyrepresentations_api?loggedInUserId=" + "/api/endpoint/getmyrepresentations_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -888,7 +900,7 @@ export const getMyRepresentationsProxy = (loggedInUserId) => {
return axios return axios
.get( .get(
"/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" + "/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -908,7 +920,8 @@ export const getRepresentations = (incidentID) => {
export const getRepresentationsProxy = (incidentID) => { export const getRepresentationsProxy = (incidentID) => {
return axios return axios
.get( .get(
"/api/endpoint/getrepresentationsproxy_api?incidentID=" + incidentID "/api/endpoint/getrepresentationsproxy_api?incidentID=" +
incidentID,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -921,7 +934,7 @@ export const getWatchedCases = (loggedInUserId) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getwatchedcases_api?loggedInUserId=" + "/api/endpoint/getwatchedcases_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -933,7 +946,7 @@ export const getWatchedCasesProxy = (loggedInUserId) => {
return axios return axios
.get( .get(
"/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" + "/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -945,7 +958,7 @@ export const getAwaitingSubmissionProxy = (loggedInUserId) => {
return axios return axios
.get( .get(
"/api/endpoint/getawaitingsubmissionproxy_api?loggedInUserId=" + "/api/endpoint/getawaitingsubmissionproxy_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -958,7 +971,7 @@ export const getAwaitingSubmission = (loggedInUserId) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" + "/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
loggedInUserId loggedInUserId,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -988,8 +1001,8 @@ export const getAwaitingSubmissionFromBlob = (containerName) => {
containerName + containerName +
hashAPIPath( hashAPIPath(
"/api/file/getawaitingsubmissionfromblob?container=" + "/api/file/getawaitingsubmissionfromblob?container=" +
containerName containerName,
) ),
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -1015,7 +1028,7 @@ export const getRepsFromBlob = (containerName) => {
BASE_URL + BASE_URL +
"/api/file/getrepsblob?container=" + "/api/file/getrepsblob?container=" +
containerName + containerName +
hashAPIPath("/api/file/getrepsblob?container=" + containerName) hashAPIPath("/api/file/getrepsblob?container=" + containerName),
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -1042,7 +1055,7 @@ export const getRepsFromBlobProxy = async (containerName) => {
try { try {
const res = await axios.get( const res = await axios.get(
// BASE_URL + // BASE_URL +
"/api/file/getrepsblobproxy?container=" + containerName "/api/file/getrepsblobproxy?container=" + containerName,
// + // +
// hashAPIPath( // hashAPIPath(
// "/api/file/getawaitingsubmissionfromblob?container=" + // "/api/file/getawaitingsubmissionfromblob?container=" +
@@ -1061,14 +1074,14 @@ export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
containerName, containerName,
"/api/file/getawaitingsubmissionfromblobproxy?container=" + "/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName, containerName,
"\n///////////////////////\n" "\n///////////////////////\n",
); );
try { try {
const res = await axios.get( const res = await axios.get(
BASE_URL + BASE_URL +
"/api/file/getawaitingsubmissionfromblobproxy?container=" + "/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName containerName,
// + // +
// hashAPIPath( // hashAPIPath(
// "/api/file/getawaitingsubmissionfromblob?container=" + // "/api/file/getawaitingsubmissionfromblob?container=" +
@@ -1129,7 +1142,7 @@ export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" + "/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
appealType + appealType +
"&caseReference=" + "&caseReference=" +
caseReference.replace(/\'/g, "''") caseReference.replace(/\'/g, "''"),
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -1141,7 +1154,7 @@ export const getEmailAccountCheck = (emailAddress) => {
return axios return axios
.get( .get(
"/api/endpoint/getemailaccountcheck_api?emailAddress=" + "/api/endpoint/getemailaccountcheck_api?emailAddress=" +
emailAddress emailAddress,
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
@@ -1213,7 +1226,7 @@ export const createNewCase = (
lpaID, lpaID,
contactid, contactid,
createBody, createBody,
containerName containerName,
) => { ) => {
appealTypeId = parseInt(appealTypeId); appealTypeId = parseInt(appealTypeId);
@@ -1250,7 +1263,7 @@ export const createNewCaseBlob = (
contactid, contactid,
createBody, createBody,
containerName, containerName,
lpaName lpaName,
) => { ) => {
appealTypeId = parseInt(appealTypeId); appealTypeId = parseInt(appealTypeId);
@@ -1302,14 +1315,14 @@ export const updateCase = async (
updateBody, updateBody,
updateFormCollection, updateFormCollection,
primaryAttribute, primaryAttribute,
caseReference caseReference,
) => { ) => {
var data = updateBody; var data = updateBody;
var appealObj = await getAppealID( var appealObj = await getAppealID(
caseReference, caseReference,
updateFormCollection, updateFormCollection,
primaryAttribute primaryAttribute,
); );
var queryUrl = var queryUrl =
@@ -1340,14 +1353,14 @@ export const updateCaseBlob = async (
updateBody, updateBody,
updateFormCollection, updateFormCollection,
primaryAttribute, primaryAttribute,
caseReference caseReference,
) => { ) => {
var data = updateBody; var data = updateBody;
var appealObj = await getAppealID( var appealObj = await getAppealID(
caseReference, caseReference,
updateFormCollection, updateFormCollection,
primaryAttribute primaryAttribute,
); );
var queryUrl = var queryUrl =
@@ -1415,7 +1428,7 @@ export const getCaseByID = (incidentID) => {
// ); // );
return axios return axios
.get( .get(
BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -1473,7 +1486,7 @@ export const deleteAwaitingSubmissions = (incidentID) => {
export const deleteAwaitingSubmissionsFromBlob = ( export const deleteAwaitingSubmissionsFromBlob = (
containerID, containerID,
casefolderID casefolderID,
) => { ) => {
var queryUrl = var queryUrl =
"/api/file/deleteblobcase?container=" + "/api/file/deleteblobcase?container=" +
@@ -1499,7 +1512,7 @@ export const deleteAwaitingSubmissionsFromBlob = (
export const deleteMyRepresentationsFromBlob = ( export const deleteMyRepresentationsFromBlob = (
containerID, containerID,
casefolderID, casefolderID,
repfile repfile,
) => { ) => {
var queryUrl = var queryUrl =
"/api/file/deleteblobrep?container=" + "/api/file/deleteblobrep?container=" +
@@ -1563,7 +1576,7 @@ export const uploadFiles = async (
formValues, formValues,
filesObj, filesObj,
containerID, containerID,
casefolderID casefolderID,
) => { ) => {
let files = filesObj; let files = filesObj;
@@ -1644,7 +1657,7 @@ export const uploadRepFiles = async (
formValues, formValues,
filesObj, filesObj,
containerID, containerID,
casefolderID casefolderID,
) => { ) => {
let files = filesObj; let files = filesObj;
@@ -1721,7 +1734,7 @@ export const generateAppealPDF = async (
containerID, containerID,
casefolderID, casefolderID,
appealType, appealType,
fileList fileList,
) => { ) => {
//let files = filesObj; //let files = filesObj;
@@ -1779,8 +1792,8 @@ export const getFilesFromBlob = (containerName, casefolderID) => {
"/api/file/getbloblist?container=" + "/api/file/getbloblist?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID casefolderID,
) ),
) )
.then((res) => { .then((res) => {
//console.log("//////////----", res.data); //console.log("//////////----", res.data);
@@ -1798,7 +1811,7 @@ export const getFilesFromBlobproxy = (containerName, casefolderID) => {
"/api/file/getbloblistproxy?container=" + "/api/file/getbloblistproxy?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID casefolderID,
) )
.then((res) => { .then((res) => {
//console.log("//////////----", res.data); //console.log("//////////----", res.data);
@@ -1812,7 +1825,7 @@ export const getFilesFromBlobproxy = (containerName, casefolderID) => {
export const getFilesFromBlobHashed = ( export const getFilesFromBlobHashed = (
containerName, containerName,
getblobshash, getblobshash,
casefolderID casefolderID,
) => { ) => {
return axios return axios
.get( .get(
@@ -1820,7 +1833,7 @@ export const getFilesFromBlobHashed = (
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + casefolderID +
getblobshash getblobshash,
) )
.then((res) => { .then((res) => {
//console.log("//////////----", res.data); //console.log("//////////----", res.data);
@@ -1835,7 +1848,7 @@ export const deleteBlob = async (
containerName, containerName,
blobName, blobName,
deleteblobhash, deleteblobhash,
casefolderID casefolderID,
) => { ) => {
try { try {
const res = await axios.get( const res = await axios.get(
@@ -1845,7 +1858,7 @@ export const deleteBlob = async (
encodeURIComponent(casefolderID) + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
encodeURIComponent(blobName) + encodeURIComponent(blobName) +
deleteblobhash deleteblobhash,
); );
return res.data; return res.data;
} catch (error) { } catch (error) {
@@ -1858,7 +1871,7 @@ export const deleteRepBlob = async (
blobName, blobName,
deleteblobhash, deleteblobhash,
casefolderID, casefolderID,
filenamePrefix filenamePrefix,
) => { ) => {
try { try {
const res = await axios.get( const res = await axios.get(
@@ -1868,7 +1881,7 @@ export const deleteRepBlob = async (
encodeURIComponent(casefolderID + "/" + filenamePrefix) + encodeURIComponent(casefolderID + "/" + filenamePrefix) +
"&blobname=" + "&blobname=" +
encodeURIComponent(blobName) + encodeURIComponent(blobName) +
deleteblobhash deleteblobhash,
); );
return res.data; return res.data;
} catch (error) { } catch (error) {
@@ -1884,14 +1897,14 @@ export const downloadBlob = (containerName, blobName) => {
containerName.toLowerCase() + containerName.toLowerCase() +
"&blobname=" + "&blobname=" +
blobName, blobName,
{ responseType: "blob" } { responseType: "blob" },
) )
.then((response) => { .then((response) => {
//console.log("Downloaded blob content:"); //console.log("Downloaded blob content:");
res.setHeader( res.setHeader(
"content-disposition", "content-disposition",
"attachment; filename=" + blobName "attachment; filename=" + blobName,
); );
//console.log("has downloaded"); //console.log("has downloaded");
@@ -1928,8 +1941,8 @@ export const getProgressFromBlob = async (containerName, casereference) => {
"/api/file/getprogressobjblob?container=" + "/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) + encodeURIComponent(containerName) +
"&casefolderID=" + "&casefolderID=" +
encodeURIComponent(casereference) encodeURIComponent(casereference),
) ),
); );
return res.data; return res.data;
} catch (error) { } catch (error) {
@@ -1941,7 +1954,7 @@ export const sendEmail = async (
templateId, templateId,
emailAddress, emailAddress,
personalisation, personalisation,
reference reference,
) => { ) => {
var mailData = { var mailData = {
"templateId": templateId, "templateId": templateId,
@@ -2042,7 +2055,7 @@ export const createContainerProxy = (containerName) => {
export const sendCaseCompleteMessage = async ( export const sendCaseCompleteMessage = async (
containerID, containerID,
caseReference, caseReference,
inv inv,
) => { ) => {
var queryUrl = var queryUrl =
"/api/file/createappealcompletemessage_api?container=" + "/api/file/createappealcompletemessage_api?container=" +
@@ -2071,7 +2084,7 @@ export const sendCaseCompleteMessage = async (
export const sendCaseCompleteMessageProxy = async ( export const sendCaseCompleteMessageProxy = async (
containerID, containerID,
caseReference caseReference,
) => { ) => {
var queryUrl = var queryUrl =
"/api/file/createappealcompletemessageproxy_api?container=" + "/api/file/createappealcompletemessageproxy_api?container=" +
@@ -2098,7 +2111,7 @@ export const sendCaseCompleteMessageProxy = async (
export const sendRepCompleteMessage = async ( export const sendRepCompleteMessage = async (
containerID, containerID,
caseReference, caseReference,
fileName fileName,
) => { ) => {
var queryUrl = var queryUrl =
"/api/file/createrepcompletemessage_api?container=" + "/api/file/createrepcompletemessage_api?container=" +
@@ -2210,7 +2223,7 @@ export const getPreferredLanguage = async (email) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getpreferredlanguage_api?emailAddress=" + "/api/endpoint/getpreferredlanguage_api?emailAddress=" +
email email,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -2226,7 +2239,7 @@ export const getAppealPDFDocument = async (incidentid) => {
.get( .get(
BASE_URL + BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" + "/api/endpoint/getappealpdfdocuments_api?incidentid=" +
incidentid incidentid,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -2251,7 +2264,7 @@ export const getNewAppealsPage = async (
pageNumber, pageNumber,
orderBy, orderBy,
fieldSort, fieldSort,
showNumberOfRecords showNumberOfRecords,
) => { ) => {
return axios return axios
.get( .get(
@@ -2264,7 +2277,7 @@ export const getNewAppealsPage = async (
"&fieldSort=" + "&fieldSort=" +
fieldSort + fieldSort +
"&showNumberOfRecords=" + "&showNumberOfRecords=" +
showNumberOfRecords showNumberOfRecords,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
@@ -2282,7 +2295,7 @@ export const getNewDocumentsPaged = async (
showNumberOfRecords, showNumberOfRecords,
documentType, documentType,
documentOrigin, documentOrigin,
selectedWeeks selectedWeeks,
) => { ) => {
console.log( console.log(
"/api/admin/getlatestdocuments_api?pageNumber=" + "/api/admin/getlatestdocuments_api?pageNumber=" +
@@ -2298,7 +2311,7 @@ export const getNewDocumentsPaged = async (
"&numberWeeks=" + "&numberWeeks=" +
selectedWeeks + selectedWeeks +
"&documentOrigin=" + "&documentOrigin=" +
documentOrigin documentOrigin,
); );
return axios return axios
.get( .get(
@@ -2315,7 +2328,7 @@ export const getNewDocumentsPaged = async (
"&numberWeeks=" + "&numberWeeks=" +
selectedWeeks + selectedWeeks +
"&documentOrigin=" + "&documentOrigin=" +
documentOrigin documentOrigin,
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
+149
View File
@@ -0,0 +1,149 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY),
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
// export default async function ApiProxy(req, res) {
// var caseid = req.query.caseid;
// var token = await getToken();
// var queryUrl =
// "pinswg_sipsevents?$filter=_pinswg_sipseventsid_value eq " +
// caseid +
// "&$count=true";
// return axios
// .get(
// WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
// azureHeaders(token.access_token),
// )
// .then(({ data }) => {
// res.status(200).json(data);
// })
// .catch((error) => {
// consoleLogger(error);
// res.status(400).json(error);
// });
// }
export default function ApiProx(req, res) {
const data = {
"@odata.count": 4,
"value": [
{
"pinswg_publishtoweb@OData.Community.Display.V1.FormattedValue":
"Yes",
"pinswg_publishtoweb": true,
"pinswg_uploadstatus": 846040000,
"pinswg_name":
"Puffin Paradise? Exploring Wales Cutest Wildlife Spot (Skomer Travel Guide)",
"pinswg_description":
"Skomer Island is a tiny uninhabited isle off the coast of Pembrokeshire in western Wales. Although it's just ten minutes from the mainland by ferry, it's home to over 40,000 puffins, the largest colony in the world of Manx Shearwaters, and lots of seals.",
"pinswg_latestpublishedversion": "1.0",
"pinswg_latestpublisheddate@OData.Community.Display.V1.FormattedValue":
"2/2/2026",
"pinswg_latestpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentid": "9d4550b7-2000-f111-aa10-002248008e24",
"createdon@OData.Community.Display.V1.FormattedValue":
"2/2/2026 10:19 AM",
"createdon": "2026-02-02T10:19:55Z",
"pinswg_hashlink":
"/api/documents/download/A22258739?hash=51d64c1330ed2fe1fb9aff4658b8eedadf1b062d2b0313b39bc5af786228324b",
"pinswg_mediaLinkEN":
"https://www.youtube.com/watch?v=H7S6CfF_7PI",
"pinswg_mediaLinkCY":
"https://www.youtube.com/watch?v=H7S6CfF_7PI",
},
{
"pinswg_publishtoweb@OData.Community.Display.V1.FormattedValue":
"Yes",
"pinswg_publishtoweb": true,
"pinswg_uploadstatus": 846040000,
"pinswg_name": "Redstone Cross - side roads",
"pinswg_description": "Redstone Cross - side roads",
"pinswg_latestpublishedversion": "1.0",
"pinswg_latestpublisheddate@OData.Community.Display.V1.FormattedValue":
"2/2/2026",
"pinswg_latestpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentid": "9d4550b7-2000-f111-aa10-002248008e24",
"createdon@OData.Community.Display.V1.FormattedValue":
"2/2/2026 10:19 AM",
"createdon": "2026-02-02T10:19:55Z",
"pinswg_hashlink":
"/api/documents/download/A22258739?hash=51d64c1330ed2fe1fb9aff4658b8eedadf1b062d2b0313b39bc5af786228324b",
"pinswg_mediaLinkEN":
"https://www.youtube.com/watch?v=OhxeLV_jPyE",
"pinswg_mediaLinkCY":
"https://www.youtube.com/watch?v=OhxeLV_jPyE",
},
{
"pinswg_publishtoweb@OData.Community.Display.V1.FormattedValue":
"Yes",
"pinswg_publishtoweb": true,
"pinswg_uploadstatus": 846040000,
"pinswg_name":
"Apprenticeships: Dinorwig Power Station (bilingual)",
"pinswg_description": "blah blah blah",
"pinswg_latestpublishedversion": "1.0",
"pinswg_latestpublisheddate@OData.Community.Display.V1.FormattedValue":
"2/2/2026",
"pinswg_latestpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentid": "9d4550b7-2000-f111-aa10-002248008e24",
"createdon@OData.Community.Display.V1.FormattedValue":
"2/2/2026 10:19 AM",
"createdon": "2026-02-02T10:19:55Z",
"pinswg_hashlink":
"/api/documents/download/A22258739?hash=51d64c1330ed2fe1fb9aff4658b8eedadf1b062d2b0313b39bc5af786228324b",
"pinswg_mediaLinkEN":
"https://www.youtube.com/watch?v=9nsmadjgW94",
"pinswg_mediaLinkCY":
"https://www.youtube.com/watch?v=9nsmadjgW94",
},
{
"pinswg_publishtoweb@OData.Community.Display.V1.FormattedValue":
"Yes",
"pinswg_publishtoweb": true,
"pinswg_uploadstatus": 846040000,
"pinswg_name":
"Climate Action Wales - Cardiff Cycle Workshop - Sustainable Cycling in Cardiff",
"pinswg_description": "blah blah blah",
"pinswg_latestpublishedversion": "1.0",
"pinswg_latestpublisheddate@OData.Community.Display.V1.FormattedValue":
"2/2/2026",
"pinswg_latestpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentpublisheddate": "2026-02-02T10:20:46Z",
"pinswg_documentid": "9d4550b7-2000-f111-aa10-002248008e24",
"createdon@OData.Community.Display.V1.FormattedValue":
"2/2/2026 10:19 AM",
"createdon": "2026-02-02T10:19:55Z",
"pinswg_hashlink":
"/api/documents/download/A22258739?hash=51d64c1330ed2fe1fb9aff4658b8eedadf1b062d2b0313b39bc5af786228324b",
"pinswg_mediaLinkEN":
"https://www.youtube.com/watch?v=tRW3tm2Mby8",
"pinswg_mediaLinkCY":
"https://www.youtube.com/watch?v=tRW3tm2Mby8",
},
],
};
return res.status(200).json(data);
}
+8
View File
@@ -8,6 +8,7 @@ export const searchResultsActionTypes = {
SETREPRESENTATIONS: "SETREPRESENTATIONS", SETREPRESENTATIONS: "SETREPRESENTATIONS",
SETDNSCOORDS: "SETDNSCOORDS", SETDNSCOORDS: "SETDNSCOORDS",
SETEVENTDETAILS: "SETEVENTDETAILS", SETEVENTDETAILS: "SETEVENTDETAILS",
SETMEDIADETAILS: "SETMEDIADETAILS",
}; };
export const getSearchResultshObj = () => (dispatch) => { export const getSearchResultshObj = () => (dispatch) => {
@@ -63,3 +64,10 @@ export const setEventDetails = (eventsDetails) => (dispatch) => {
eventDetailsObj: eventsDetails, eventDetailsObj: eventsDetails,
}); });
}; };
export const setMediaDetails = (mediaDetails) => (dispatch) => {
return dispatch({
type: searchResultsActionTypes.SETMEDIADETAILS,
mediaDetailsObj: mediaDetails,
});
};
+6
View File
@@ -7,6 +7,7 @@ const searchResultsInitialState = {
representationsObj: {}, representationsObj: {},
dnsCoordsObj: {}, dnsCoordsObj: {},
eventDetailsObj: {}, eventDetailsObj: {},
mediaDetailsObj: {},
}; };
export default function reducer(state = searchResultsInitialState, action) { export default function reducer(state = searchResultsInitialState, action) {
@@ -42,6 +43,11 @@ export default function reducer(state = searchResultsInitialState, action) {
...state, ...state,
eventDetailsObj: action.eventDetailsObj, eventDetailsObj: action.eventDetailsObj,
}; };
case searchResultsActionTypes.SETMEDIADETAILS:
return {
...state,
mediaDetailsObj: action.mediaDetailsObj,
};
default: default:
return state; return state;
} }