Add featured adventure locations and fix conditional rendering in log page

This commit is contained in:
Sean Morley
2024-04-02 18:31:44 +00:00
parent ad568bb3fa
commit 9baab4c675
3 changed files with 14 additions and 4 deletions

View File

@@ -29,9 +29,10 @@ export function addAdventure(adventure: Adventure) {
adventures = [...adventures, adventure];
if (isBrowser) {
localStorage.setItem('adventures', JSON.stringify(adventures));
visitCount.update((n) => n + 1);
}
console.log(adventures);
visitCount.update((n) => n + 1);
}
export function getAdventures(): Adventure[] {
@@ -42,8 +43,9 @@ export function removeAdventure(event: { detail: number; }) {
adventures = adventures.filter(adventure => adventure.id !== event.detail);
if (isBrowser) {
localStorage.setItem('adventures', JSON.stringify(adventures));
visitCount.update((n) => n - 1);
}
visitCount.update((n) => n - 1);
}
export function saveEdit(adventure:Adventure) {
@@ -70,7 +72,9 @@ export function clearAdventures() {
adventures = [];
if (isBrowser) {
localStorage.setItem('adventures', JSON.stringify(adventures));
visitCount.set(0);
}
}