added google map api

This commit is contained in:
suryac 2026-07-31 12:33:24 +05:30
parent 25e27d9d4d
commit 1539dfef7f
2 changed files with 2 additions and 6 deletions

View File

@ -27,11 +27,9 @@ export function GeolocationInput({
const [isMapModalOpen, setIsMapModalOpen] = useState(false);
const [mapMarkerPos, setMapMarkerPos] = useState<{ lat: number; lng: number } | null>(null);
const isLocalhost = typeof window !== 'undefined' && (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
const { isLoaded } = useJsApiLoader({
id: 'google-map-script',
googleMapsApiKey: isLocalhost ? '' : (import.meta.env.VITE_GOOGLE_MAPS_API_KEY || '')
googleMapsApiKey: import.meta.env.VITE_GOOGLE_MAPS_API_KEY || ''
});
// Extract lat, lng & accuracy from value (supporting both latitude/longitude and lat/lng)

View File

@ -50,11 +50,9 @@ export function DailyLogMap({
const [error, setError] = useState<string | null>(null);
const mapRef = useRef<google.maps.Map | null>(null);
const isLocalhost = typeof window !== 'undefined' && (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
const { isLoaded } = useJsApiLoader({
id: 'google-map-script',
googleMapsApiKey: isLocalhost ? '' : (import.meta.env.VITE_GOOGLE_MAPS_API_KEY || '')
googleMapsApiKey: import.meta.env.VITE_GOOGLE_MAPS_API_KEY || ''
});
const fetchNearestStores = async (lat: number, lng: number) => {