diff --git a/src/lib/components/editor.svelte b/src/lib/components/editor.svelte
index ad61cb8..04f35a5 100644
--- a/src/lib/components/editor.svelte
+++ b/src/lib/components/editor.svelte
@@ -1,30 +1,52 @@
-{JSON.stringify(entry)}
+
+
{formatDate(entry.date)}
-
- {entry["date"]}
-
\ No newline at end of file
+ {#if !edit}
+
+ {:else}
+
+
+
+ {/if}
+
diff --git a/src/lib/upload.ts b/src/lib/upload.ts
index 909a120..b97b8ed 100644
--- a/src/lib/upload.ts
+++ b/src/lib/upload.ts
@@ -55,3 +55,19 @@ export async function updateEntry(entry) {
body: JSON.stringify(entry),
});
}
+
+export async function deleteEntry(entry) {
+ 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');
+ }
+}
\ No newline at end of file