Merged PR 1190: improved error loggin and updated imports to fix build failure

improved error loggin and updated imports to fix build failure

Related work items: #8436
This commit is contained in:
Robert Bond
2024-06-19 14:08:31 +00:00
78 changed files with 319 additions and 325 deletions
+2 -10
View File
@@ -149,17 +149,9 @@ export const createContainer = async (containerName) => {
.then((data) => { .then((data) => {
return data; return data;
}) })
.catch((err) => { .catch((error) => {
console.log("has error", err); consoleLogger(error);
}); });
//console.log(
// "\n//////////////////\n container name :",
// containerName,
// "\n//////////////////\n"
// );
console.log(createContainerResponse);
return createContainerResponse; return createContainerResponse;
}; };
+54 -38
View File
@@ -39,6 +39,7 @@ export const getIP = (req) => {
}; };
export const consoleLogger = (err) => { export const consoleLogger = (err) => {
//console.log(err);
var errStr = var errStr =
"\n\n/////////////////////////////////////////////////\nServer Error " + "\n\n/////////////////////////////////////////////////\nServer Error " +
"\n" + "\n" +
@@ -72,8 +73,11 @@ export const consoleLogger = (err) => {
(_.has(err, "config.url") (_.has(err, "config.url")
? "\nAxios message url: " + err.message + "\n" ? "\nAxios message url: " + err.message + "\n"
: "") + : "") +
(_.has(err, "config.data")
? "\nRequest payload: " + err.config.data + "\n"
: "") +
"\n/////////////////////////////////////////////////\n\n"; "\n/////////////////////////////////////////////////\n\n";
return errStr; console.log(errStr);
}; };
export const conLog = (err) => { export const conLog = (err) => {
@@ -212,7 +216,7 @@ export const getBasicSearch = (searchString) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -228,7 +232,7 @@ export const getIncidentbyID = (searchString) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -242,7 +246,7 @@ export const getIsPublishedbyID = (searchString) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -258,7 +262,7 @@ export const getPartSavedAppeal = (searchString) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -274,7 +278,7 @@ export const getBasicDNSURLSearch = (searchString) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -303,6 +307,7 @@ export const getAddressSearchPaged = (
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -331,6 +336,7 @@ export const getBasicSearchPaged = (
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -342,6 +348,7 @@ export const getDNSCoords = () => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -357,6 +364,7 @@ export const getDNSList = (searchString) => {
.get(BASE_URL + "/api/endpoint/getdnslist_api") .get(BASE_URL + "/api/endpoint/getdnslist_api")
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -366,6 +374,7 @@ export const getBasicDNSSearch = (searchString) => {
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api") .get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -389,6 +398,7 @@ export const getBasicDNSSearchPaged = (
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error);
return error.response; return error.response;
}); });
}; };
@@ -402,6 +412,7 @@ export const getAdvancedSearch = (searchString) => {
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -434,6 +445,7 @@ export const getAdvancedSearchPaged = (
) )
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -594,7 +606,6 @@ export const getAppealsTypes = () => {
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
consoleLogger(error); consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -610,7 +621,7 @@ export const getAppealsTypesForNewAppeal = () => {
.get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api") .get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api")
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
//console.log(error); consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -628,6 +639,7 @@ export const getLPA = () => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error);
let ErrResponse = { let ErrResponse = {
value: [], value: [],
errorCode: error.response.status, errorCode: error.response.status,
@@ -926,7 +938,7 @@ export const getRepsFromBlob = (containerName) => {
// error + // error +
// "\n///////////////////////\n" // "\n///////////////////////\n"
// ); // );
console.log(consoleLogger(error)); consoleLogger(error);
//console.log("API call error", error); //console.log("API call error", error);
}); });
}; };
@@ -1070,9 +1082,8 @@ export const updateAccount = async (contactId, updateBody) => {
}); });
}; };
export const createWatchedCases = (formValues) => { export const createWatchedCases = async (formValues) => {
var data = formValues; var data = formValues;
//var queryUrl = window.apiRoot + "/api/endpoint/createwatchedcases_api";
var queryUrl = "/api/endpoint/createwatchedcases_api"; var queryUrl = "/api/endpoint/createwatchedcases_api";
var config = { var config = {
@@ -1081,13 +1092,14 @@ export const createWatchedCases = (formValues) => {
data: data, data: data,
}; };
return axios(config) console.log("===§=§=§=§=§=§=§=§=§=", config);
.then((res) => {
return res.data; try {
}) const res = await axios(config);
.catch((error) => { return res.data;
consoleLogger(error); } catch (error) {
}); consoleLogger(error);
}
}; };
export const createNewCase = ( export const createNewCase = (
@@ -1778,10 +1790,10 @@ export const getPortalLogin = async (emailAddress) => {
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress; "/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
return axios return axios
.get(BASE_URL + queryUrl) .get(BASE_URL + queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
console.log(consoleLogger(error)); consoleLogger(error);
return JSON.stringify(error); return JSON.stringify(error);
}); });
@@ -1797,7 +1809,7 @@ export const createContainerProxy = (containerName) => {
.get(BASE_URL + queryUrl) .get(BASE_URL + queryUrl)
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
console.log(consoleLogger(error)); consoleLogger(error);
return JSON.stringify(error); return JSON.stringify(error);
}); });
@@ -1886,21 +1898,25 @@ export const getAddressSearch = async (searchString) => {
const params = new URLSearchParams(searchString); const params = new URLSearchParams(searchString);
const str = params.toString(); const str = params.toString();
//console.log( var queryUrl =
// "the url", BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str;
// BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str
// ); var config = {
try { method: "get",
const res = await axios.get( url: queryUrl,
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str };
);
return res.data; return axios(config)
} catch (error) { .then((res) => {
let ErrResponse = { return res.data;
value: [], })
errorCode: error.response.status, .catch((error) => {
errorMsg: error.response.statusText, consoleLogger(error);
}; let ErrResponse = {
return ErrResponse; value: [],
} errorCode: error.response.status,
errorMsg: error.response.statusText,
};
return ErrResponse;
});
}; };
+1 -1
View File
@@ -11,7 +11,7 @@ export default function Inspectorate() {
return ( return (
<div className="card clear" id="inspectorate-card"> <div className="card clear" id="inspectorate-card">
<div className="card-body"> <div className="card-body">
<img <Image
alt={t("home:inspectorate-card-alt-text")} alt={t("home:inspectorate-card-alt-text")}
src="/assets/images/PINS_dual_logo_400.png" src="/assets/images/PINS_dual_logo_400.png"
width="380px" width="380px"
+3 -3
View File
@@ -121,9 +121,9 @@ const TopThree = (props) => {
setMyRepresentations(data); setMyRepresentations(data);
setMyRepresentationsDetails(data); setMyRepresentationsDetails(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
.then(() => { .then(() => {
setCurrentView({ setCurrentView({
+3 -3
View File
@@ -778,9 +778,9 @@ const ViewAllResults = (props) => {
setMyRepresentations(data); setMyRepresentations(data);
setMyRepresentationsDetails(data); setMyRepresentationsDetails(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
.then(() => { .then(() => {
setCurrentView({ setCurrentView({
-1
View File
@@ -460,7 +460,6 @@ let AboutYou = (props) => {
const onHandleSubmit = (values) => { const onHandleSubmit = (values) => {
event.preventDefault(); event.preventDefault();
console.log(JSON.stringify(values));
window.scrollTo({ top: 0, behavior: "smooth" }); window.scrollTo({ top: 0, behavior: "smooth" });
setFormStep(1); setFormStep(1);
}; };
+2 -2
View File
@@ -460,8 +460,8 @@ let CreateCase = (props) => {
); );
return data; return data;
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
}); });
// router.replace( // router.replace(
+4 -4
View File
@@ -257,11 +257,11 @@ const SearchResults = (props) => {
href={ href={
(router.locale == "cy" (router.locale == "cy"
? myportal == true ? myportal == true
? "/fymhorth/achos/id" ? "/fymhorth/achos"
: "/achos/id" : "/achos"
: myportal == true : myportal == true
? "/myportal/case/" ? "/myportal/case"
: "/case/") + : "/case") +
"/" + "/" +
item.pinswg_name item.pinswg_name
} }
+2 -2
View File
@@ -62,7 +62,7 @@ const prisma = new PrismaClient();
// // emailReplyToId: emailReplyToId, // // emailReplyToId: emailReplyToId,
// }) // })
// //.then((response) => console.log(response)) // //.then((response) => console.log(response))
// .catch((err) => consoleLogger(err)); // .catch((error) => consoleLogger(err));
// }, // },
// }), // }),
// ], // ],
@@ -201,7 +201,7 @@ const authOptions = (locale, req, res) => {
} }
) )
//.then((response) => console.log(response)) //.then((response) => console.log(response))
.catch((err) => consoleLogger(err)); .catch((error) => consoleLogger(err));
}, },
}), }),
], ],
+3 -3
View File
@@ -103,8 +103,8 @@ export default async function ApiProxy(req, res) {
return "downloadComplete"; return "downloadComplete";
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -47,9 +47,9 @@ export default async function ApiProxy(req, res) {
//console.log("thisis the response", response); //console.log("thisis the response", response);
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
return res.status(400).json(err); return res.status(400).json(error);
}); });
//return res.status(200).json(data); //return res.status(200).json(data);
} }
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -109,9 +109,9 @@ export default async function ApiProxy(req, res) {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
//console.log(consoleLogger(err)); //consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return apiResponse; return apiResponse;
+4 -11
View File
@@ -37,8 +37,6 @@ export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body); var data = JSON.stringify(req.body);
var queryUrl = "pinswg_watchlists"; var queryUrl = "pinswg_watchlists";
console.log(data);
var config = { var config = {
method: "post", method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
@@ -46,24 +44,19 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
data: data, data: data,
}; };
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
console.log(data);
return axios(config) return axios(config)
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl)); consoleLogger(Object.assign(err, data));
console.log(data); res.status(400).json(error);
console.log(consoleLogger(err));
res.status(400).json(err);
}); });
} }
@@ -44,7 +44,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -52,11 +52,10 @@ export default async function ApiProxy(req, res) {
return axios(config) return axios(config)
.then(({ data }) => { .then(({ data }) => {
//console.log("deleted awaitingsubmission case - " + incidentID);
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -44,7 +44,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+4 -4
View File
@@ -46,7 +46,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -57,8 +57,8 @@ export default async function ApiProxy(req, res) {
//console.log("deleted watched case - " + watchedCaseID); //console.log("deleted watched case - " + watchedCaseID);
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -102,9 +102,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return apiResponse; return apiResponse;
@@ -146,9 +146,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return apiResponse; return apiResponse;
+3 -3
View File
@@ -69,8 +69,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -49,8 +49,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -57,8 +57,8 @@ export default async function ApiProxy(req, res) {
}); });
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -50,8 +50,8 @@ export default async function ApiProxy(req, res) {
}); });
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -59,8 +59,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -57,9 +57,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
@@ -60,9 +60,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
@@ -95,8 +95,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -69,9 +69,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
@@ -43,8 +43,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+7 -9
View File
@@ -53,12 +53,10 @@ export default async function ApiProxy(req, res) {
console.log( console.log(
"\n==========================================\n", "\n==========================================\n",
"basic search: " + queryUrl, "\nBasic search ",
"\n\n", "\nSearch String: " + searchString,
"basic search relay link: " + "\n\nQuery url: " + queryUrl,
WEBAPI_URL + "\n\nRelay link: " + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
queryUrl +
hashAPIPath(queryUrl),
"\n==========================================\n" "\n==========================================\n"
); );
@@ -77,9 +75,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
@@ -460,9 +460,9 @@ export default async function ApiProxy(req, res) {
}); });
return searchResultsObj.push(data); return searchResultsObj.push(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return resultObj; return resultObj;
@@ -479,9 +479,9 @@ export default async function ApiProxy(req, res) {
}); });
return searchResultsObj.push(data); return searchResultsObj.push(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return resultObj; return resultObj;
@@ -517,13 +517,6 @@ export default async function ApiProxy(req, res) {
}) })
); );
console.log(
"===========n\n appellant name:",
appellantname,
addressline1,
county
);
if (req.query.hasOwnProperty("appellantname")) { if (req.query.hasOwnProperty("appellantname")) {
searchResultsObj = searchResultsObj.filter( searchResultsObj = searchResultsObj.filter(
(arr) => (arr) =>
@@ -68,10 +68,10 @@ export default async function ApiProxy(req, res) {
console.log( console.log(
"\n==========================================\n", "\n==========================================\n",
"\ndetails query: ", "\nSearch Details query ",
queryUrl, "\nAppealType: " + appealTypeName,
"\n\n", "\nIncident ID: " + incidentID,
"<<<<end query", "\n\nQuery url: " + queryUrl,
"\n==========================================\n" "\n==========================================\n"
); );
@@ -83,8 +83,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -84,8 +84,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -112,9 +112,9 @@ export default async function ApiProxy(req, res) {
dataStr.split("/v8.2/")[1])); dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -36,8 +36,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -41,8 +41,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -55,9 +55,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
+3 -3
View File
@@ -37,8 +37,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -69,9 +69,9 @@ export default async function ApiProxy(req, res) {
//); //);
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
+3 -3
View File
@@ -67,8 +67,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -70,9 +70,9 @@ export default async function ApiProxy(req, res) {
console.log(data); console.log(data);
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
+3 -3
View File
@@ -49,8 +49,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -61,8 +61,8 @@ export default async function ApiProxy(req, res) {
}); });
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -76,8 +76,8 @@ export default async function ApiProxy(req, res) {
}); });
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -55,8 +55,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -56,9 +56,9 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
+31 -19
View File
@@ -39,31 +39,43 @@ const hashAPIPath = (queryPath) => {
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
var emailAddress = req.query.emailAddress; var emailAddress = req.query.emailAddress;
var token = await getToken(); var token = await getToken();
var checkHash = req.query.hash;
var checkquerypath =
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
// console.log("-----", casefolderID);
// console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
var queryUrl = var queryUrl =
"contacts?$filter=emailaddress1 eq '" + "contacts?$filter=emailaddress1 eq '" +
emailAddress + emailAddress +
"' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname"; "' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
console.log(req.query, queryUrl); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
var apiResponse = _.isEmpty(req.query)
var apiResponse = _.isEmpty(req.query) ? res.status(400).json()
? res.status(400).json() : typeof emailAddress != "undefined" && emailAddress.length > 0
: typeof emailAddress != "undefined" && emailAddress.length > 0 ? axios
? axios .get(
.get( WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token.access_token)
azureHeadersPaged(token.access_token) )
) .then(({ data }) => {
.then(({ data }) => { //console.log(data);
//console.log(data); res.status(200).json(data);
res.status(200).json(data); })
}) .catch((error) => {
.catch((err) => { consoleLogger(error);
console.log(consoleLogger(err)); res.status(400).json(error);
res.status(400).json(err); })
}) : res.status(400).json();
: res.status(400).json(); } else {
return res.status(400).json();
}
return apiResponse; return apiResponse;
} }
@@ -59,9 +59,9 @@ export default async function ApiProxy(req, res) {
//console.log(data); //console.log(data);
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}) })
: res.status(400).json(); : res.status(400).json();
@@ -68,8 +68,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -64,8 +64,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -91,8 +91,8 @@ export default async function ApiProxy(req, res) {
// (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); // (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(dataArr); res.status(200).json(dataArr);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -80,8 +80,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -130,8 +130,8 @@ export default async function ApiProxy(req, res) {
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -54,8 +54,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -85,8 +85,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -79,8 +79,8 @@ export default async function ApiProxy(req, res) {
}); });
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -53,8 +53,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -3
View File
@@ -64,9 +64,9 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
return apiResponse; return apiResponse;
+4 -4
View File
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -58,8 +58,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+1 -1
View File
@@ -49,7 +49,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
+4 -4
View File
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -56,8 +56,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -45,9 +45,9 @@ ApiProxy.get(async (req, res) => {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
console.log(consoleLogger(err)); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
}); });
+3 -3
View File
@@ -246,8 +246,8 @@ export default async function handler(req, res) {
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`, path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`,
}); });
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
@@ -38,8 +38,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+7 -3
View File
@@ -49,15 +49,19 @@ ApiProxy.get(async (req, res) => {
"&casefolderID=" + "&casefolderID=" +
casefolderID; casefolderID;
//console.log(hashAPIPath(checkquerypath), checkHash); // console.log("-----", casefolderID);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); // console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await getBlobs(containerName, casefolderID).then((data) => { await getBlobs(containerName, casefolderID).then((data) => {
return res.status(200).json({ "value": [data] }); return res.status(200).json({ "value": [data] });
}); });
} else { } else {
return res.status(400).json({ "error": "ooops" }); return res.status(400).json();
} }
}); });
+6 -2
View File
@@ -21,8 +21,12 @@ ApiProxy.get(async (req, res) => {
"&casefolderID=" + "&casefolderID=" +
casefolderID; casefolderID;
//console.log(hashAPIPath(checkquerypath), checkHash); // console.log("-----", casefolderID);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); // console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getProgressBlobs(containerName, casefolderID) const blobObj = await getProgressBlobs(containerName, casefolderID)
+2 -15
View File
@@ -58,15 +58,9 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getRepsBlobs(containerName, casefolderID) const blobObj = await getRepsBlobs(containerName, casefolderID)
.then(async (data) => { .then(async (data) => {
//console.log(
// "\n////////////////////////////\n getRepsBlobs:",
// data
// );
return data; return data;
}) })
.then(async (data) => { .then(async (data) => {
//console.log("\n////////////////////////////\n now here:", data);
let result = await downloadAllRepsFiles(containerName, data); let result = await downloadAllRepsFiles(containerName, data);
return res return res
@@ -75,17 +69,10 @@ ApiProxy.get(async (req, res) => {
.json(result); .json(result);
}) })
.catch((error) => { .catch((error) => {
//console.log( consoleLogger(error);
// "///////////////////////\ngetRepsFromBlob api in api route response: " +
// error +
// "\n///////////////////////\n"
// );
//console.log("API call error", error);
console.log(consoleLogger(error));
}); });
} else { } else {
return res.status(400).json({ msg: "error" }); return res.status(400).json();
} }
}); });
+3 -3
View File
@@ -37,8 +37,8 @@ export default async function ApiProxy(req, res) {
.then(({ data }) => { .then(({ data }) => {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((err) => { .catch((error) => {
consoleLogger(err); consoleLogger(error);
res.status(400).json(err); res.status(400).json(error);
}); });
} }
+3 -5
View File
@@ -23,13 +23,11 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await createContainer(containerName) await createContainer(containerName)
.then((data) => { .then((data) => {
//console.log("has response:", data);
return res.status(200).json({ data: "success" }); return res.status(200).json({ data: "success" });
}) })
.catch((err) => { .catch((error) => {
console.log(err); consoleLogger(error);
console.log(consoleLogger(err)); res.status(400).json(error);
res.status(400).json(err);
}); });
} else { } else {
return res.status(400).json(); return res.status(400).json();
+3 -2
View File
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
"OData-MaxVersion": "4.0", "OData-MaxVersion": "4.0",
"OData-Version": "4.0", "OData-Version": "4.0",
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*"', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -51,6 +51,7 @@ export default async function ApiProxy(req, res) {
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((error) => { .catch((error) => {
res.status(400); consoleLogger(error);
res.status(400).json(error);
}); });
} }
-2
View File
@@ -169,8 +169,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
await getWatchedCases(loggedInUser), await getWatchedCases(loggedInUser),
]); ]);
console.log(accountDetails);
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([ const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj), await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"), await getDetails(watchedCases, "myWatchedCases"),
+1 -1
View File
@@ -77,7 +77,7 @@ startServer(serverConfig)
await app.prepare(); await app.prepare();
}) })
.catch((err) => { .catch((error) => {
console.error(err); console.error(err);
process.exit(1); process.exit(1);