Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.   onButtonClick = (event) => {
  3.     this.getGoogleApiCoords(this.state.departureInput).then(a => {
  4.       this.renderInfo(a.data.results[0].geometry.location)
  5.     });
  6.     event.preventDefault();
  7.   }
  8.  
  9.   getGoogleApiCoords = (name) => {
  10.     return axios.get(
  11.       'https://maps.googleapis.com/maps/api/geocode/json?address='+ name + '&key=AIzaSyBAdK6_AsKrGFNLDyUfDqYL4MF53CI68rw')
  12.       .then(response => {
  13.         return response;
  14.       })
  15.       .catch(error => {
  16.         return error;
  17.       });
  18.   }
  19.  
  20.   renderInfo = (location) => {
  21.     const departureLocation= {
  22.       lat: location.lat,
  23.       lng: location.lng
  24.     };
  25.     console.log(departureLocation.lat);
  26.     console.log(departureLocation.lng);
  27.     // dalje zovi oblak komponente sa ovim lat i lng odavde
  28.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement