Last active
February 23, 2018 05:30
-
-
Save kameshsampath/efc3c3fe396b34af56ff93d44796675c to your computer and use it in GitHub Desktop.
The snippet to show whats the wrong code looks like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const gmap = require('@google/maps'); | |
function location(params) { | |
const latlng = JSON.parse(JSON.stringify(params.coords)) | |
const gmapClient = gmap.createClient({ | |
key: process.env.GOOGLE_MAPS_API_KEY | |
}) | |
gmapClient.reverseGeocode({ | |
"latlng": latlng, | |
"result_type": "postal_code" | |
},function(function(results, status){ | |
if (status === 'OK'){ | |
return {status: 'Err',location: response.json.results[0].formatted_address} | |
}else{ | |
return {status: status,location: 'Unknown'} | |
} | |
}) | |
return {status: status,location: 'Unknown'} | |
} | |
global.main = location; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment