Compare commits
2 Commits
f30262be3b
...
d2e5e8f69d
| Author | SHA1 | Date | |
|---|---|---|---|
| d2e5e8f69d | |||
| 817c857fde |
@@ -57,17 +57,11 @@ export async function updateEntry(entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteEntry(entry) {
|
export async function deleteEntry(entry) {
|
||||||
const res = await fetch(`/api/entry/delete`, {
|
await fetch(`/api/entry/delete`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ id: entry.id })
|
body: JSON.stringify({ id: entry.id })
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.ok) {
|
|
||||||
entry = null;
|
|
||||||
} else {
|
|
||||||
alert('Failed to delete entry');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -16,10 +16,13 @@
|
|||||||
let { children, data } = $props();
|
let { children, data } = $props();
|
||||||
let dateValue = $derived(data.date);
|
let dateValue = $derived(data.date);
|
||||||
let entries = $derived(data.entries);
|
let entries = $derived(data.entries);
|
||||||
|
let title = $state("Memento")
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
// Navigate when dateValue changes
|
// Navigate when dateValue changes
|
||||||
goto(`/${dateValue}`);
|
goto(`/${dateValue}`);
|
||||||
|
title = `Memento: ${dateValue}`
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -28,7 +31,10 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head><link rel="icon" href={favicon} /></svelte:head>
|
<svelte:head>
|
||||||
|
<title>{title}</title>
|
||||||
|
<link rel="icon" href={favicon} />
|
||||||
|
</svelte:head>
|
||||||
<ModeWatcher />
|
<ModeWatcher />
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user