diff --git a/frontend/src/lib/components/AdventureModal.svelte b/frontend/src/lib/components/AdventureModal.svelte index 7f5597b..c197990 100644 --- a/frontend/src/lib/components/AdventureModal.svelte +++ b/frontend/src/lib/components/AdventureModal.svelte @@ -261,6 +261,22 @@ new_notes = ''; } + async function markVisited() { + console.log(reverseGeocodePlace); + if (reverseGeocodePlace) { + let res = await fetch(`/worldtravel?/markVisited`, { + method: 'POST', + body: JSON.stringify({ regionId: reverseGeocodePlace.id }) + }); + if (res.ok) { + reverseGeocodePlace.is_visited = true; + addToast('success', `Visit to ${reverseGeocodePlace.region} marked`); + } else { + addToast('error', `Failed to mark visit to ${reverseGeocodePlace.region}`); + } + } + } + async function reverseGeocode() { let res = await fetch( `/api/reverse-geocode/reverse_geocode/?lat=${adventure.latitude}&lon=${adventure.longitude}` @@ -612,10 +628,32 @@ it would also work to just use on:click on the MapLibre component itself. --> {#if reverseGeocodePlace}
{reverseGeocodePlace.id}
{reverseGeocodePlace.region}, {reverseGeocodePlace.country}
{reverseGeocodePlace.is_visited ? 'Visited' : 'Not Visited'}