daniele
11/21/2017, 4:40 PMdaniele
11/21/2017, 4:40 PMdaniele
11/21/2017, 4:40 PMersherr
11/21/2017, 4:49 PMDukuo
11/21/2017, 4:54 PMDukuo
11/21/2017, 4:57 PMFunctions
nilan
11/21/2017, 4:58 PMDukuo
11/21/2017, 5:28 PMgc playground
command changes to the stand-alone electron app after the installation? because it still takes me to the web version whenever I run it on my local projectnilan
11/21/2017, 5:29 PMDukuo
11/21/2017, 5:50 PMpicosam
11/21/2017, 6:05 PMDukuo
11/21/2017, 6:13 PMgraphcool-lib
?mimica
11/21/2017, 6:20 PMjohhansantana
11/21/2017, 6:26 PMjohhansantana
11/21/2017, 6:26 PMpanzupa
11/21/2017, 6:40 PMpanzupa
11/21/2017, 6:41 PMdoug_w
11/21/2017, 6:46 PMREQUEST PIPELINE -> ADDRESS IS CREATED
. Basically before an Address is saved in the database, the function should use the Google Maps API to get the geolocation information and add it to the address before save. The promise
to get the geolocation info works in a regular node ENV. I am unable to use the info my promise returns in order to tac it on to the address. The event always comes back blank.
'use strict'
const googleMapsClient = require('@google/maps').createClient({
key: 'SUPER_KEY'
})
const getGeolocation = (address) =>
new Promise((resolve, reject) => {
googleMapsClient.geocode({
address: address
}, (err, response) => {
if(err) {
resolve(err)
} else {
const locationResult = response.json.results[0].geometry.location
const geolocation = {
lat: locationResult.lat,
lng: locationResult.lng,
isGeolocated: true
}
resolve(geolocation)
}
})
})
module.exports = function (event) {
getGeolocation('1600 Amphitheatre Parkway, Mountain View, CA')
.then(geolocation => {
event.data.lat = geolocation.lat
event.data.lng = geolocation.lng
event.data.isGeolocated = geolocation.isGeolocated
return {data: event.data}
})
.catch(err => console.log(err))
return event
}
Is this not a proper use case for this type of function?
Edit I have dumbed down my initial approach a lot. I can not get it to modify the input, or return any value what’s so ever:
export default event => {
console.log(`event: ${event}`)
event.data.billingPhone = "3333333"
return event
}
ersherr
11/21/2017, 6:47 PMDukuo
11/21/2017, 7:13 PMJhony Reyes
11/21/2017, 8:36 PMaurnik
11/21/2017, 9:11 PMdoug_w
11/21/2017, 9:33 PMmatty
11/21/2017, 9:56 PMmatty
11/21/2017, 9:57 PMmatty
11/21/2017, 10:05 PMcachemoi
11/21/2017, 11:12 PMersherr
11/21/2017, 11:12 PMersherr
11/21/2017, 11:14 PMersherr
11/21/2017, 11:56 PM