-
Documents
+
{t("case:documents-heading-label")}
{_.isEmpty(documentHistoryObj) ? (
-
There are no documents for this appeal
+
+ {t("case:documents-non-available-label")}
+
) : (
diff --git a/components/case/summary.js b/components/case/summary.js
index 76b629b0..27de4e8e 100644
--- a/components/case/summary.js
+++ b/components/case/summary.js
@@ -607,7 +607,7 @@ const CaseSummary = (props) => {
useEffect(() => {
const linkCaseObj = async () => {
let docObj = await getLinkedCases(incidentid).then((data) => {
- console.log(data);
+ //console.log(data);
setCurrentLinkedCases(data);
return data;
});
@@ -636,7 +636,7 @@ const CaseSummary = (props) => {
}
function linkedCasesList(linkedCasesReference) {
- console.log(linkedCasesReference);
+ //console.log(linkedCasesReference);
linkedCasesReference = linkedCasesReference.value || [];
diff --git a/components/footer.js b/components/footer.js
index 85b7dc7d..dd26c902 100644
--- a/components/footer.js
+++ b/components/footer.js
@@ -27,7 +27,7 @@ export default function Footer(props) {
: setShowShareState(true);
};
- console.log(router.asPath);
+ //console.log(router.asPath);
const shareBodyStr = t("common:gov-wales-link") + router.asPath;
const shareSubjectStr =
t("common:social-shared-from") +
diff --git a/locales/cy/case.json b/locales/cy/case.json
index 876004ef..67ffb6b7 100644
--- a/locales/cy/case.json
+++ b/locales/cy/case.json
@@ -34,5 +34,7 @@
"documents-name-label": "Math y Ddogfen",
"documents-doc-type-label": "Math y Ddogfen",
"documents-date-published-label": "Dyddiad cyhoeddi",
- "documents-size-label": "Maint y ffeil (kb)"
+ "documents-size-label": "Maint y ffeil (kb)",
+ "documents-non-available-label": "Nid oes unrhyw ddogfennau ar gyfer yr apĂȘl hon",
+ "documents-heading-label": "Dogfennau"
}
\ No newline at end of file
diff --git a/locales/en/case.json b/locales/en/case.json
index c86707c4..7f4129eb 100644
--- a/locales/en/case.json
+++ b/locales/en/case.json
@@ -34,5 +34,7 @@
"documents-name-label": "Name",
"documents-doc-type-label": "Document type",
"documents-date-published-label": "Date published",
- "documents-size-label": "Size (KB)"
+ "documents-size-label": "Size (KB)",
+ "documents-non-available-label": "There are no documents for this appeal",
+ "documents-heading-label": "Documents"
}
\ No newline at end of file
diff --git a/pages/api/proxy/[...route].js b/pages/api/proxy/[...route].js
index 8fbad3f4..454592a9 100644
--- a/pages/api/proxy/[...route].js
+++ b/pages/api/proxy/[...route].js
@@ -1,6 +1,7 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
+import { response } from "express";
const PROXY_RELAY_URL =
"https://" +
@@ -62,24 +63,9 @@ const getSASToken = () => {
export default async function ApiProxy(req, res) {
console.log(req.method);
- var updateBody = {
- "pinswg_areaofsiteinhectaresdec": 21,
- "pinswg_developmentaffectsettingifalisted": false,
- "pinswg_floorspaceinsquaremeters": "123123124",
- "pinswg_incarelatestoca": false,
- "pinswg_isfloodinganissue": true,
- "pinswg_isthesitewithinanaonb": false,
- "pinswg_landuse": "846040002",
- "pinswg_sitewithinsssi": true,
- "pinswg_sitewithinagreenbelt": false,
- "pinswg_siteviewablefromroad": false,
- "pinswg_typeofplanningapplication": "846040000",
- };
var data = JSON.stringify(req.body);
const SASToken = getSASToken();
- // console.log(SASToken);
-
var configNoData = {
method: req.method,
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
@@ -109,17 +95,44 @@ export default async function ApiProxy(req, res) {
data: data,
};
- console.log(req.url.split("/api/proxy/")[1]);
+ var configDocument = {
+ method: req.method,
+ url: PROXY_RELAY_URL + req.url.split("/api/proxy/")[1],
+ headers: {
+ "OData-MaxVersion": "4.0",
+ "OData-Version": "4.0",
+ "Accept": "application/json",
+ "Prefer": 'odata.include-annotations="*",return=representation',
+ "Authorization": SASToken,
+ "Content-Type": "application/json",
+ },
+ responseType: "arraybuffer",
+ };
return new Promise((resolve, reject) => {
- console.log(config);
- axios(req.method == "GET" ? configNoData : config)
+ let apiPath = req.url.split("/api/proxy/")[1];
+ let hasDocument = apiPath.indexOf("/download") > 0 ? true : false;
+
+ axios(
+ req.method == "GET"
+ ? hasDocument
+ ? configDocument
+ : configNoData
+ : config
+ )
.then((response) => {
+ // console.log(response);
res.statusCode = 200;
- res.setHeader("Content-Type", "application/json");
- res.setHeader("Cache-Control", "max-age=1800000");
- res.end(JSON.stringify(response.data));
- console.log("response data", response.data);
+ if (hasDocument) {
+ res.setHeader("Content-Type", "text/plain");
+ res.end(response.data);
+ } else {
+ res.setHeader("Content-Type", "application/json");
+ res.setHeader("Cache-Control", "max-age=1800000");
+ res.end(JSON.stringify(response.data));
+ }
+
+ //console.log("response data", response.data);
resolve();
})
.catch((error) => {