Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4671 | Rev 4673 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4671 Rev 4672
Línea 53... Línea 53...
53
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
53
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
54
  autoComplete = new window.google.maps.places.Autocomplete(
54
  autoComplete = new window.google.maps.places.Autocomplete(
55
    autoCompleteRef.current,
55
    autoCompleteRef.current,
56
    { types: ["(cities)"]}
56
    { types: ["(cities)"]}
57
  );
57
  );
58
  console.log(autoComplete)
-
 
59
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
58
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
60
  autoComplete.addListener("place_changed", () =>
-
 
61
    handlePlaceSelect(updateQuery, setAddresObject, setError)
-
 
62
  );
-
 
63
}
-
 
Línea 64... Línea -...
64
 
-
 
65
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
59
 
66
  const addressObject = autoComplete.getPlace();
-
 
67
  // console.log(addressObject.geometry.location.lat());
-
 
68
  // console.log(addressObject.geometry.location.lng());
60
  const addressObject = autoComplete.getPlace();
-
 
61
  const query = addressObject.formatted_address;
69
  const query = addressObject.formatted_address;
62
 
-
 
63
  if(query){
-
 
64
    handlePlaceSelect(query,updateQuery, setAddresObject, setError)
-
 
65
  } else {
-
 
66
    setError("$error_msg")
-
 
67
  }
-
 
68
 
-
 
69
  autoComplete.addListener("place_changed", () =>
-
 
70
    handlePlaceSelect(query,updateQuery, setAddresObject, setError)
-
 
71
  );
-
 
72
}
-
 
73
 
-
 
74
async function handlePlaceSelect(query,updateQuery, setAddresObject, setError) {
70
  if(query){
75
 
71
    setError("");
76
    setError("");
72
    updateQuery(query);
77
    updateQuery(query);
73
    setAddresObject({
78
    setAddresObject({
74
      ...addressObject, 
79
      ...addressObject, 
Línea 78... Línea 83...
78
        latitude: addressObject.geometry.location.lat(),
83
        latitude: addressObject.geometry.location.lat(),
79
        longitude: addressObject.geometry.location.lng(), 
84
        longitude: addressObject.geometry.location.lng(), 
80
        types:["geometry"]
85
        types:["geometry"]
81
      }
86
      }
82
    ]
87
    ]
83
  });
88
  })
84
  }else{
-
 
85
    setError("$error_msg");
-
 
86
  }
-
 
87
}
89
}
Línea 88... Línea 90...
88
 
90
 
89
const skillsArray = Object.entries($userSkills).map(([key, value]) => ({ value: key, name: value }))
91
const skillsArray = Object.entries($userSkills).map(([key, value]) => ({ value: key, name: value }))
90
const skillsOptions = Object.entries($skillsOptions).map(([key, value]) => ({ value: key, name: value }))
92
const skillsOptions = Object.entries($skillsOptions).map(([key, value]) => ({ value: key, name: value }))