Add DELETE endpoint to visits API and update log page

This commit is contained in:
Sean Morley
2024-04-10 14:33:41 +00:00
parent 4c032445a7
commit 7ba879f7d9
4 changed files with 90 additions and 28 deletions

View File

@@ -7,13 +7,13 @@ import { visitCount } from "$lib/utils/stores/visitCountStore";
// Check if localStorage is available (browser environment)
const isBrowser = typeof window !== "undefined";
// Load adventures from localStorage on startup (only in the browser)
if (isBrowser) {
const storedAdventures = localStorage.getItem("adventures");
if (storedAdventures) {
adventures = JSON.parse(storedAdventures);
}
}
// // Load adventures from localStorage on startup (only in the browser)
// if (isBrowser) {
// const storedAdventures = localStorage.getItem("adventures");
// if (storedAdventures) {
// adventures = JSON.parse(storedAdventures);
// }
// }
export function getNextId() {
let nextId = Math.max(0, ...adventures.map((adventure) => adventure.id)) + 1;