From 2d3ad7c32341a2268e7e4b056baad88fa737ce2d Mon Sep 17 00:00:00 2001 From: Janani NA Date: Mon, 24 Aug 2020 14:56:37 -0700 Subject: [PATCH] code cleanup --- client/src/components/Map/Map.js | 17 ++--------------- client/src/pages/Results/ResultsFacts.js | 1 - routes/results.js | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/client/src/components/Map/Map.js b/client/src/components/Map/Map.js index d169829..2407cde 100644 --- a/client/src/components/Map/Map.js +++ b/client/src/components/Map/Map.js @@ -48,22 +48,9 @@ export class MapContainer extends Component { this.state.markerLocation.lng ).then( (response) => { - console.log(response) - // const address = response.results[0].formatted_address; + const country = response.results[response.results.length-1].formatted_address; - console.log(country) -/* let addrArr = address.split(","); - let country = addrArr[addrArr.length - 1]; - console.log("country",country) - if(country.trim() === "USA"){ - console.log("Inside USA") - country = "United States" - } - if(country.trim() === "UK"){ - console.log("Inside UK") - console.log("country",country) - country = "United Kingdom" - } */ + if ( country.toLowerCase().trim() === this.props.country.toLowerCase().trim() diff --git a/client/src/pages/Results/ResultsFacts.js b/client/src/pages/Results/ResultsFacts.js index 1b37c87..af269c4 100644 --- a/client/src/pages/Results/ResultsFacts.js +++ b/client/src/pages/Results/ResultsFacts.js @@ -7,7 +7,6 @@ function ResultsFacts({ country }) { // API call to get the facts about a given country function getFacts() { API.getCountryFacts(country).then((res) => { - console.log(res); setFacts(res.data); }); } diff --git a/routes/results.js b/routes/results.js index 374314f..f1f5866 100644 --- a/routes/results.js +++ b/routes/results.js @@ -45,7 +45,6 @@ const resultDataToUpdate = (data, req) => { const objKey = Object.keys(obj); //checking for key match irrespective of case if (objKey[0].toLowerCase() === continent[0].toLowerCase()) { - console.log("continent present"); //Both the objects uses same key with diffrent cases, so refering the objects with respective key obj[objKey] = req.body.results[continent]; isContnentPresent = true;