debuf fix on search results

This commit is contained in:
2022-07-21 08:07:46 +01:00
parent f4d6cfb2d8
commit a14726ee0a
3 changed files with 36 additions and 34 deletions
+6 -2
View File
@@ -31,8 +31,11 @@ export const consoleLogger = (err) => {
err.response.status + err.response.status +
" : " + " : " +
err.response.statusText + err.response.statusText +
"\nRequest URL: " +
err.response.config.url +
"\nRequest Time: " +
err.response.headers.date +
"\n///////"; "\n///////";
return errStr; return errStr;
}; };
@@ -50,7 +53,8 @@ export const getToken = () => {
}) })
.catch((error) => { .catch((error) => {
//console.log("error :", error.response); //console.log("error :", error.response);
// return error; consoleLogger(error);
return error;
}); });
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
import axios from "axios"; import axios from "axios";
import https from "https"; import https from "https";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { getToken } from "../../../../actions"; import { getToken, consoleLogger } from "../../../../actions";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
+12 -14
View File
@@ -128,16 +128,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
let searchResultsObj = await getBasicSearch(query.q); let searchResultsObj = await getBasicSearch(query.q);
if (_.has(searchResultsObj, "status") != false) {
if (searchResultsObj.status == 400) {
return {
redirect: {
//destination: "/dns-not-found",
destination: "/error",
permanent: false,
},
};
} else {
searchResultsObj = searchResultsObj =
searchResultsObj.status == 502 searchResultsObj.status == 502
? { ? {
@@ -147,8 +137,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
} }
: searchResultsObj; : searchResultsObj;
//console.log("sssss", searchResultsObj); if (_.has(searchResultsObj, "status") == true) {
return {
redirect: {
//destination: "/dns-not-found",
destination: "/error",
permanent: false,
},
};
} else {
const searchDetailsObj = await getSearchDetails( const searchDetailsObj = await getSearchDetails(
searchResultsObj searchResultsObj
); );
@@ -156,13 +153,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj)); store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(query.q)); store.dispatch(setSearch(query.q));
}
return { return {
props: { isLinkedCase: isLinked }, props: { isLinkedCase: isLinked },
}; };
} }
} // }
} // }
); );
const mapStateToProps = (state) => { const mapStateToProps = (state) => {