defect fixes
This commit is contained in:
@@ -78,21 +78,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const searchDocumentResultsObj = await getDocumentDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
|
||||
const searchDocumentHistoryObj = await getDocumentHistory(
|
||||
token,
|
||||
searchDocumentResultsObj
|
||||
);
|
||||
//console.log(searchDocumentHistoryObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setDocumentDetails(searchDocumentResultsObj));
|
||||
store.dispatch(setDocumentHistory(searchDocumentHistoryObj));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -136,51 +124,6 @@ const getSearchDetails = (token, searchResultsObj) => {
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentDetails = (token, searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
//console.log("search results", searchResultsObj);
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.incidentid);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getSearchDocumentDetails(token, searchDetail.incidentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentHistory = (token, searchDocumentDetailsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let historyArr = [];
|
||||
//console.log("search results", searchDocumentDetailsObj);
|
||||
searchDocumentDetailsObj = searchDocumentDetailsObj[0].value;
|
||||
|
||||
//console.log(searchDocumentDetailsObj);
|
||||
const detailsObj = searchDocumentDetailsObj.map((historyDetail, index) => {
|
||||
//console.log(historyDetail);
|
||||
if (historyDetail.pinswg_publishtoweb != true) {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
// console.log(
|
||||
// "history detail documentid:",
|
||||
// historyDetail.pinswg_documentid
|
||||
// );
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory(token, historyDetail.pinswg_documentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
console.log(historyArr);
|
||||
return Promise.all(historyArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
|
||||
@@ -2,18 +2,9 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
const WEBAPI_URL = "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
// const azureHeaders = {
|
||||
// headers: {
|
||||
// "OData-MaxVersion": "4.0",
|
||||
// "OData-Version": "4.0",
|
||||
// "Accept": "application/json",
|
||||
// "Prefer": 'odata.include-annotations="*",return=representation',
|
||||
// "Content-Type": "application/json",
|
||||
// "ServiceBusAuthorization": SASToken,
|
||||
// },
|
||||
// };
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const getSASToken = () => {
|
||||
var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net";
|
||||
@@ -52,7 +43,7 @@ const getSASToken = () => {
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
// console.log(req.method);
|
||||
console.log(req.method);
|
||||
|
||||
var updateBody = {
|
||||
"pinswg_areaofsiteinhectaresdec": 21,
|
||||
@@ -104,14 +95,14 @@ export default async function ApiProxy(req, res) {
|
||||
console.log(req.url.split("/api/proxy/")[1]);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// console.log(config);
|
||||
//console.log(config);
|
||||
axios(req.method == "GET" ? configNoData : config)
|
||||
.then((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);
|
||||
//console.log("response data", response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user