updated serching to reduce CRM calls for performance and stability
This commit is contained in:
+30
-27
@@ -124,38 +124,41 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
"public, s-maxage=10, stale-while-revalidate=59"
|
||||
);
|
||||
|
||||
let searchResultsObj = await getBasicDNSSearch();
|
||||
// let searchResultsObj = await getBasicDNSSearch();
|
||||
|
||||
searchResultsObj =
|
||||
searchResultsObj.status == 502
|
||||
? {
|
||||
value: [],
|
||||
errorCode: searchResultsObj.status,
|
||||
errorMsg: searchResultsObj.statusText,
|
||||
}
|
||||
: searchResultsObj;
|
||||
// searchResultsObj =
|
||||
// searchResultsObj.status == 502
|
||||
// ? {
|
||||
// value: [],
|
||||
// errorCode: searchResultsObj.status,
|
||||
// errorMsg: searchResultsObj.statusText,
|
||||
// }
|
||||
// : searchResultsObj;
|
||||
|
||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||
const showMapCheck = process.env.SHOWMAPS || false;
|
||||
|
||||
if (_.has(searchResultsObj, "status") == true) {
|
||||
return {
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/error",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
searchResultsObj
|
||||
);
|
||||
const dnsCoords = await getDNSCoords();
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch("DNS"));
|
||||
store.dispatch(setDNSCoords(dnsCoords));
|
||||
}
|
||||
// if (_.has(searchResultsObj, "status") == true) {
|
||||
// return {
|
||||
// redirect: {
|
||||
// //destination: "/dns-not-found",
|
||||
// destination: "/error",
|
||||
// permanent: false,
|
||||
// },
|
||||
// };
|
||||
// } else {
|
||||
// // const searchDetailsObj = await getSearchDetails(
|
||||
// // searchResultsObj
|
||||
// // );
|
||||
// const dnsCoords = await getDNSCoords();
|
||||
// // store.dispatch(setSearchResults(searchResultsObj));
|
||||
// // store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
// store.dispatch(setSearch("DNS"));
|
||||
// store.dispatch(setDNSCoords(dnsCoords));
|
||||
// }
|
||||
const dnsCoords = await getDNSCoords();
|
||||
store.dispatch(setSearch("DNS"));
|
||||
store.dispatch(setDNSCoords(dnsCoords));
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user