From 771a5c2bf7480b6e023d8eeeded1c6f698b779e8 Mon Sep 17 00:00:00 2001 From: Pitu Date: Tue, 12 Mar 2019 06:32:10 +0000 Subject: Not tested, but should delete an album --- src/site/pages/dashboard/albums.vue | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'src/site') diff --git a/src/site/pages/dashboard/albums.vue b/src/site/pages/dashboard/albums.vue index a2e151e..2da4beb 100644 --- a/src/site/pages/dashboard/albums.vue +++ b/src/site/pages/dashboard/albums.vue @@ -189,7 +189,7 @@
- {{ album.fileCount - 5 }}+ more + {{ album.fileCount - 5 }}+ more
@@ -300,6 +306,30 @@ export default { this.getAlbums(); }, methods: { + promptDeleteAlbum(id) { + this.$dialog.confirm({ + message: 'Are you sure you want to delete this album?', + onConfirm: () => this.deleteAlbum(id) + }); + }, + promptPurgeAlbum(id) { + this.$dialog.confirm({ + message: 'Would you like to delete every file associated with this album?', + cancelText: 'No', + confirmText: 'Yes', + onConfirm: () => this.deleteAlbum(id, true), + onCancel: () => this.deleteAlbum(id, false) + }); + }, + async deleteAlbum(id, purge) { + try { + const response = await this.axios.delete(`${this.config.baseURL}/album/${id}/${purge ? true : ''}`); + this.getAlbums(); + return this.$toast.open(response.data.message); + } catch (error) { + return this.$onPromiseError(error); + } + }, promptDeleteAlbumLink(identifier) { this.$dialog.confirm({ message: 'Are you sure you want to delete this album link?', @@ -341,9 +371,9 @@ export default { enableDownload: true, expiresAt: null }); - album.isCreatingLink = false; } catch (error) { this.$onPromiseError(error); + } finally { album.isCreatingLink = false; } }, @@ -355,7 +385,6 @@ export default { this.newAlbumName = null; this.$toast.open(response.data.message); this.getAlbums(); - return; } catch (error) { this.$onPromiseError(error); } @@ -367,9 +396,8 @@ export default { album.isDetailsOpen = false; } this.albums = response.data.albums; - console.log(this.albums); } catch (error) { - console.error(error); + this.$onPromiseError(error); } } } -- cgit v1.2.3