1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

Refactor getAdventures and removeAdventure in log page

This commit is contained in:
Sean Morley 2024-04-06 12:54:27 +00:00
parent ea79fd2d76
commit fe042f3a5b

View file

@ -61,14 +61,19 @@
};
onMount(async () => {
adventures = getAdventures();
// adventures = getAdventures();
console.log(data.result);
adventures = data.result.adventures;
});
function triggerRemoveAdventure(event: { detail: number }) {
removeAdventure(event);
showToast("removed");
adventures = getAdventures();
// remove from data.result.adventures
data.result.adventures = data.result.adventures.filter(
(adventure: Adventure) => adventure.id !== event.detail
);
}
function saveAdventure(event: { detail: Adventure }) {