From da9145a91f768cb6a164fab64fa818ea01096d6c Mon Sep 17 00:00:00 2001
From: jackie / Andrea Ida Malkah Klaura <jackie@diebin.at>
Date: Tue, 14 May 2019 15:54:50 +0200
Subject: [PATCH] FEAT: implement delete of playlist

---
 src/components/FileManager.vue | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/components/FileManager.vue b/src/components/FileManager.vue
index 8e4a161d..278de9c9 100644
--- a/src/components/FileManager.vue
+++ b/src/components/FileManager.vue
@@ -579,8 +579,18 @@ export default {
     },
 
     deletePlaylist: function (id) {
-      this.notYetImplemented()
-      return id
+      var uri = process.env.VUE_APP_API_TANK + 'shows/' + this.shows[this.currentShow].slug + '/playlists/' + id
+      // TODO: add mechanism to indicate the running delete request in the files table
+      axios.delete(uri, {
+        withCredentials: true,
+        headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token },
+      }).then(
+        this.fetchPlaylists(this.shows[this.currentShow].slug)
+      ).catch(error => {
+        console.log('Error:')
+        console.log(error)
+        alert('Error: could not delete playlist. See console log for details.')
+      })
     },
 
     editPlaylist: function (id) {
-- 
GitLab