fix(SW-1014): Fixed issue where google didn't found city.

This commit is contained in:
Pontus Dreij
2024-11-25 15:38:08 +01:00
parent 0a35243d88
commit 0ef12d4a29
7 changed files with 50 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import { StaticMapProps } from "@/types/components/maps/staticMap"
export default function StaticMap({
city,
country,
coordinates,
width,
height,
@@ -18,7 +19,9 @@ export default function StaticMap({
const key = env.GOOGLE_STATIC_MAP_KEY
const secret = env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET
const baseUrl = "https://maps.googleapis.com/maps/api/staticmap"
const center = coordinates ? `${coordinates.lat},${coordinates.lng}` : city
const center = coordinates
? `${coordinates.lat},${coordinates.lng}`
: `${city}, ${country}`
if (!center) {
return null