Enhance Adventure model and serializers with visited status logic and toast notifications for marking visits
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
}
|
||||
|
||||
$: if (triggerMarkVisted && willBeMarkedVisited) {
|
||||
markVisited();
|
||||
displaySuccessToast(); // since the server will trigger the geocode automatically, we just need to show the toast and let the server handle the rest. It's kinda a placebo effect...
|
||||
triggerMarkVisted = false;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
function displaySuccessToast() {
|
||||
if (reverseGeocodePlace) {
|
||||
if (reverseGeocodePlace.region) {
|
||||
addToast('success', `Visit to ${reverseGeocodePlace.region} marked`);
|
||||
}
|
||||
if (reverseGeocodePlace.city) {
|
||||
addToast('success', `Visit to ${reverseGeocodePlace.city} marked`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function markVisited() {
|
||||
console.log(reverseGeocodePlace);
|
||||
if (reverseGeocodePlace) {
|
||||
|
||||
@@ -45,6 +45,9 @@ export type Adventure = {
|
||||
category: Category | null;
|
||||
attachments: Attachment[];
|
||||
user?: User | null;
|
||||
city?: string | null;
|
||||
region?: string | null;
|
||||
country?: string | null;
|
||||
};
|
||||
|
||||
export type AdditionalAdventure = Adventure & {
|
||||
|
||||
Reference in New Issue
Block a user