updated serching to reduce CRM calls for performance and stability

This commit is contained in:
2025-10-28 11:21:38 +00:00
parent df199cff53
commit e54a0b2253
12 changed files with 265 additions and 164 deletions
+30 -27
View File
@@ -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: {