import { BASE_URL, API_KEY } from "./apiConfig.js"; function responseACB(response) { if (!response.ok) { throw new Error(`HTTP error, Status: ${response.status}`); } return response.json(); } export function searchMap(city) { const param = { q: `${city}, charging_station`, format: "json", addressdetails: "addressdetails", }; const urlSearch = new URLSearchParams(param); const url = BASE_URL + "search?" + urlSearch.toString(); return fetch(url, { method: "GET", headers: { "X-API-Key": API_KEY, }, }).then(responseACB); }