From 65585369eb27ddb29e4534c141cba9f9aef1c276 Mon Sep 17 00:00:00 2001
From: Ava Brandt <s72069@beuth-hochschule.de>
Date: Tue, 5 Jan 2021 16:09:50 +0100
Subject: [PATCH] delete deck

---
 src/pages/Deckubersicht.svelte | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/pages/Deckubersicht.svelte b/src/pages/Deckubersicht.svelte
index 1ff66e8..ebef546 100644
--- a/src/pages/Deckubersicht.svelte
+++ b/src/pages/Deckubersicht.svelte
@@ -35,6 +35,14 @@ async function deckanlegen(){
     getDecks();
 };
 
+async function deleteDeck(deck) {
+    await fetch(`${crudcrudUrl}/decks/${deck._id}`, {
+        method: 'DELETE',
+        mode: 'cors'
+    });
+    getDecks();
+}
+
 </script>
 
 <div class="Decksubersicht">
@@ -47,6 +55,7 @@ async function deckanlegen(){
 
                 <p>{deck.name}</p>
                 <a href="/deck/{deck._id}">Deck bearbeiten</a>
+                <button on:click={() => deleteDeck(deck)}>Löschen</button>
 
             </div>
         {/each}
-- 
GitLab