@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.cjs +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -340,6 +340,8 @@ var handleApiError = (error, message) => {
|
|
|
340
340
|
};
|
|
341
341
|
var useLocationSearch = (googleApi) => {
|
|
342
342
|
const getPredictions = async (text) => {
|
|
343
|
+
console.log("Fetching predictions for:", text);
|
|
344
|
+
console.log("Using Google API key:", googleApi);
|
|
343
345
|
try {
|
|
344
346
|
const response = await fetch(
|
|
345
347
|
`https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${googleApi}`
|
|
@@ -348,6 +350,7 @@ var useLocationSearch = (googleApi) => {
|
|
|
348
350
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
349
351
|
}
|
|
350
352
|
const data = await response.json();
|
|
353
|
+
console.log("Predictions data:", data);
|
|
351
354
|
return data.predictions;
|
|
352
355
|
} catch (error) {
|
|
353
356
|
console.error("Error fetching predictions:", error);
|
|
@@ -397,6 +400,7 @@ var useLocationSearch = (googleApi) => {
|
|
|
397
400
|
type: "Point"
|
|
398
401
|
// Mongoose GeoJSON type
|
|
399
402
|
};
|
|
403
|
+
console.log("New location created:", newLocation);
|
|
400
404
|
return newLocation;
|
|
401
405
|
} catch (error) {
|
|
402
406
|
handleApiError(error, "Failed to fetch place details.");
|