removed proxy and added endpoints for methods

This commit is contained in:
2022-01-11 17:51:41 +00:00
parent b88bbb2696
commit 545f1c9b78
52 changed files with 2236 additions and 822 deletions
+12 -30
View File
@@ -12,10 +12,10 @@ import CryptoJS from "crypto-js";
import {
getBasicSearch,
getBasicSearchDetails,
getSearchDocumentDetails1,
getSearchDocumentHistory1,
getSearchDocumentHistory1Paged,
getSearchDocumentDetails1Paged,
getSearchDocumentDetails,
getSearchDocumentHistory,
getSearchDocumentHistoryPaged,
getSearchDocumentDetailsPaged,
getToken,
} from "../../actions";
@@ -105,9 +105,9 @@ const DocumentDetails = (props) => {
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<a
href={encryptDocReference(
detailsObj.pinswg_isharedocumentreference
)}
href={
detailsObj.pinswg_hashlink
}
>
<span className="results-visually-hidden">
{t(
@@ -191,23 +191,9 @@ const DocumentDetails = (props) => {
);
};
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (
"/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
);
};
useEffect(() => {
const docDetailsObj = async () => {
let docObj = await getSearchDocumentDetails1(incidentid)
let docObj = await getSearchDocumentDetails(incidentid)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -239,7 +225,7 @@ const DocumentDetails = (props) => {
console.log(historyDetail.pinswg_documentid);
} else {
historyArr.push(
getSearchDocumentHistory1(
getSearchDocumentHistory(
historyDetail.pinswg_documentid
)
);
@@ -252,8 +238,7 @@ const DocumentDetails = (props) => {
}, [incidentid, setDocumentHistory, setDocumentDetails]);
const getDocumentResults = (pageNumber) => {
//console.log(advancedSearch, searchString, pageNumber);
getSearchDocumentDetails1Paged(incidentid, pageNumber)
getSearchDocumentDetailsPaged(incidentid, pageNumber)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -269,10 +254,7 @@ const DocumentDetails = (props) => {
};
const getDocumentDetails = async () => {
let docObj = await getSearchDocumentDetails1Paged(
incidentid,
pageNumber
)
let docObj = await getSearchDocumentDetailsPaged(incidentid, pageNumber)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -303,7 +285,7 @@ const DocumentDetails = (props) => {
console.log(historyDetail.pinswg_documentid);
} else {
historyArr.push(
getSearchDocumentHistory1Paged(
getSearchDocumentHistoryPaged(
historyDetail.pinswg_documentid,
pageNumber
)
+1 -6
View File
@@ -73,12 +73,7 @@ const RepresentationList = (props) => {
return (
<div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<a
href={
"/api/proxy/documents/download/" +
detailsObj.pinswg_isharedocumentreference
}
>
<a href={detailsObj.pinswg_hashlink}>
<span className="results-visually-hidden">
{t("case:documents-name-label")}:
</span>