@timardex/cluemart-shared 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -179,6 +179,8 @@ var handleApiError = (error, message) => {
179
179
  };
180
180
  var useLocationSearch = (googleApi) => {
181
181
  const getPredictions = async (text) => {
182
+ console.log("Fetching predictions for:", text);
183
+ console.log("Using Google API key:", googleApi);
182
184
  try {
183
185
  const response = await fetch(
184
186
  `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${googleApi}`
@@ -187,6 +189,7 @@ var useLocationSearch = (googleApi) => {
187
189
  throw new Error(`HTTP error! Status: ${response.status}`);
188
190
  }
189
191
  const data = await response.json();
192
+ console.log("Predictions data:", data);
190
193
  return data.predictions;
191
194
  } catch (error) {
192
195
  console.error("Error fetching predictions:", error);
@@ -236,6 +239,7 @@ var useLocationSearch = (googleApi) => {
236
239
  type: "Point"
237
240
  // Mongoose GeoJSON type
238
241
  };
242
+ console.log("New location created:", newLocation);
239
243
  return newLocation;
240
244
  } catch (error) {
241
245
  handleApiError(error, "Failed to fetch place details.");