added encypted document link

This commit is contained in:
2021-11-12 12:53:51 +00:00
parent 891106bcc9
commit 2dbed4c0ca
2 changed files with 18 additions and 2 deletions
+15 -1
View File
@@ -7,6 +7,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json";
import PaginationControl from "./pagination";
import LoadingOverlay from "react-loading-overlay";
import CryptoJS from "crypto-js";
import {
getBasicSearch,
@@ -106,7 +107,9 @@ const DocumentDetails = (props) => {
<a
href={
"/api/proxy/documents/download/" +
detailsObj.pinswg_isharedocumentreference
encryptDocReference(
detailsObj.pinswg_isharedocumentreference
)
}
>
<span className="results-visually-hidden">
@@ -191,6 +194,17 @@ const DocumentDetails = (props) => {
);
};
const encryptDocReference = (documentRef) => {
var encrypted = encodeURIComponent(
CryptoJS.AES.encrypt(
documentRef,
process.env.NEXT_PUBLIC_ISHARESECRETPHRASE
)
);
return encrypted;
};
useEffect(() => {
const docDetailsObj = async () => {
let docObj = await getSearchDocumentDetails1(incidentid)