diff --git a/src/customFields/geoPicker/GeoPicker.tsx b/src/customFields/geoPicker/GeoPicker.tsx index 64cf359..db5a2a9 100644 --- a/src/customFields/geoPicker/GeoPicker.tsx +++ b/src/customFields/geoPicker/GeoPicker.tsx @@ -1,15 +1,13 @@ import * as React from 'react'; -import { useField, Label, TextInput } from 'payload/components/forms'; +import { useField } from 'payload/components/forms'; export const GeoPicker: React.FC<{ path: string }> = ({ path }) => { const { value, setValue } = useField({ path }); - const [latitude, setLatitude] = React.useState(""); - const [longitude, setLongitude] = React.useState(""); + const [longitude, setLongitude] = React.useState(value[0]); + const [latitude, setLatitude] = React.useState(value[1]); const handleCityEnter = async (e) => { - console.log("Handle key") if (e.key === 'Enter') { - console.log("Enter: " + e.target.value) try { const response = await fetch( `https://nominatim.openstreetmap.org/search?format=json&q=${e.target.value}` @@ -20,7 +18,6 @@ export const GeoPicker: React.FC<{ path: string }> = ({ path }) => { setLatitude(lat); setLongitude(lon); setValue([lon, lat]); - console.log(data) } } catch (error) { console.error('Error fetching geolocation:', error);