diff --git a/src/lib/components/editor/index.svelte b/src/lib/components/editor/index.svelte index e0ba0bf..25a022f 100644 --- a/src/lib/components/editor/index.svelte +++ b/src/lib/components/editor/index.svelte @@ -17,6 +17,22 @@ } edit = false; } + + async function deleteEntry() { + const res = await fetch(`/api/entry/delete`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ id: entry.id }) + }); + + if (res.ok) { + entry = null; + } else { + alert('Failed to delete entry'); + } + }
@@ -24,7 +40,13 @@ {#if edit} +