Removed proxy and added api calls, has gov gateway auth
This commit is contained in:
@@ -12,11 +12,10 @@ import CryptoJS from "crypto-js";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails1,
|
||||
getSearchDocumentHistory1,
|
||||
getSearchDocumentHistory1Paged,
|
||||
getSearchDocumentDetails1Paged,
|
||||
getToken,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getSearchDocumentHistoryPaged,
|
||||
getSearchDocumentDetailsPaged,
|
||||
} from "../../actions";
|
||||
|
||||
import {
|
||||
@@ -105,9 +104,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 +190,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 +224,7 @@ const DocumentDetails = (props) => {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory1(
|
||||
getSearchDocumentHistory(
|
||||
historyDetail.pinswg_documentid
|
||||
)
|
||||
);
|
||||
@@ -252,8 +237,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 +253,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 +284,7 @@ const DocumentDetails = (props) => {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory1Paged(
|
||||
getSearchDocumentHistoryPaged(
|
||||
historyDetail.pinswg_documentid,
|
||||
pageNumber
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user