Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onButtonClick = (event) => {
- this.getGoogleApiCoords(this.state.departureInput).then(a => {
- this.renderInfo(a.data.results[0].geometry.location)
- });
- event.preventDefault();
- }
- getGoogleApiCoords = (name) => {
- return axios.get(
- 'https://maps.googleapis.com/maps/api/geocode/json?address='+ name + '&key=AIzaSyBAdK6_AsKrGFNLDyUfDqYL4MF53CI68rw')
- .then(response => {
- return response;
- })
- .catch(error => {
- return error;
- });
- }
- renderInfo = (location) => {
- const departureLocation= {
- lat: location.lat,
- lng: location.lng
- };
- console.log(departureLocation.lat);
- console.log(departureLocation.lng);
- // dalje zovi oblak komponente sa ovim lat i lng odavde
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement