mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 04:35:19 +02:00
Refactor getAdventures and removeAdventure in log page
This commit is contained in:
parent
ea79fd2d76
commit
fe042f3a5b
1 changed files with 6 additions and 1 deletions
|
@ -61,14 +61,19 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
adventures = getAdventures();
|
// adventures = getAdventures();
|
||||||
console.log(data.result);
|
console.log(data.result);
|
||||||
|
adventures = data.result.adventures;
|
||||||
});
|
});
|
||||||
|
|
||||||
function triggerRemoveAdventure(event: { detail: number }) {
|
function triggerRemoveAdventure(event: { detail: number }) {
|
||||||
removeAdventure(event);
|
removeAdventure(event);
|
||||||
showToast("removed");
|
showToast("removed");
|
||||||
adventures = getAdventures();
|
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 }) {
|
function saveAdventure(event: { detail: Adventure }) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue