mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 05:05:17 +02:00
Enhance Adventure model and serializers with visited status logic and toast notifications for marking visits
This commit is contained in:
parent
84cd136401
commit
a1062e72cf
4 changed files with 45 additions and 12 deletions
|
@ -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 & {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue