rendering pins on map based on firestore document

This commit is contained in:
2026-06-06 13:58:26 +09:00
parent 8dcdd7a0e4
commit b8567ef513
4 changed files with 49 additions and 2 deletions

View File

@@ -3,6 +3,8 @@
import MapView from '$lib/components/MapView.svelte';
import { getNearbyMessages } from '$lib/firebase/messages.js';
import { messagesStore } from '$lib/stores/messagesStore.js';
let lat = $state();
let lng = $state();
@@ -22,6 +24,14 @@
error = "Location access denied. Please enable location to use Overheard.";
}
);
// populate the messages store
navigator.geolocation.getCurrentPosition(
async (position) => {
const messages = await getNearbyMessages(position.coords.latitude, position.coords.longitude);
messagesStore.set(messages);
console.log('messages loaded:', $messagesStore);
}
);
});