diff --git a/src/components/PlaylistView/Header.vue b/src/components/PlaylistView/Header.vue
index 515252af..ab0af21e 100644
--- a/src/components/PlaylistView/Header.vue
+++ b/src/components/PlaylistView/Header.vue
@@ -29,7 +29,7 @@
>Last updated {{ info.last_updated }} |
Edit |
-
+
@@ -63,6 +63,10 @@ useVisibility(playlistheader, nav.toggleShowPlay);
function editPlaylist() {
modal.showEditPlaylistModal(info.value);
}
+
+function deletePlaylist() {
+ modal.showDeletePlaylistModal(parseInt(playlist.info.id));
+}
diff --git a/src/composables/fetch/playlists.ts b/src/composables/fetch/playlists.ts
index 8c39dfef..1f13ad51 100644
--- a/src/composables/fetch/playlists.ts
+++ b/src/composables/fetch/playlists.ts
@@ -79,7 +79,10 @@ async function addTrackToPlaylist(playlist: Playlist, track: Track) {
return;
}
- new Notification(track.title + " added to " + playlist.name, NotifType.Success);
+ new Notification(
+ track.title + " added to " + playlist.name,
+ NotifType.Success
+ );
}
async function getPlaylist(pid: string) {
@@ -153,6 +156,20 @@ export async function getPlaylistArtists(pid: string): Promise {
return [];
}
+export async function deletePlaylist(pid: string) {
+ console.log(pid);
+ const { status } = await useAxios({
+ url: paths.api.playlist.base + "/delete",
+ props: {
+ pid,
+ },
+ });
+
+ if (status == 200) {
+ new Notification("Playlist deleted", NotifType.Success);
+ }
+}
+
export {
createNewPlaylist,
getAllPlaylists,
diff --git a/src/stores/modal.ts b/src/stores/modal.ts
index 9f889353..ef9811a6 100644
--- a/src/stores/modal.ts
+++ b/src/stores/modal.ts
@@ -5,6 +5,7 @@ enum ModalOptions {
newPlaylist,
updatePlaylist,
welcome,
+ deletePlaylist,
}
export default defineStore("newModal", {
@@ -33,8 +34,15 @@ export default defineStore("newModal", {
showWelcomeModal() {
this.showModal(ModalOptions.welcome);
},
+ showDeletePlaylistModal(pid: number) {
+ this.props = {
+ pid: pid,
+ };
+ this.showModal(ModalOptions.deletePlaylist);
+ },
hideModal() {
this.visible = false;
+ this.setTitle("");
},
setTitle(new_title: string) {
this.title = new_title;