aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPitu <[email protected]>2019-03-12 06:32:10 +0000
committerPitu <[email protected]>2019-03-12 06:32:10 +0000
commit771a5c2bf7480b6e023d8eeeded1c6f698b779e8 (patch)
treefa2aa44ee9f8e76abcefdc703fea91c9be8e26ef /src
parentAdd TODO (diff)
downloadhost.fuwn.me-771a5c2bf7480b6e023d8eeeded1c6f698b779e8.tar.xz
host.fuwn.me-771a5c2bf7480b6e023d8eeeded1c6f698b779e8.zip
Not tested, but should delete an album
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/albums/albumDELETE.js1
-rw-r--r--src/site/pages/dashboard/albums.vue38
2 files changed, 33 insertions, 6 deletions
diff --git a/src/api/routes/albums/albumDELETE.js b/src/api/routes/albums/albumDELETE.js
index adaa02f..b43d046 100644
--- a/src/api/routes/albums/albumDELETE.js
+++ b/src/api/routes/albums/albumDELETE.js
@@ -1,6 +1,5 @@
const Route = require('../../structures/Route');
const Util = require('../../utils/Util');
-const log = require('../../utils/Log');
class albumDELETE extends Route {
constructor() {
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 @@
</div>
<div v-if="album.fileCount > 5"
class="thumb more no-background">
- <router-link :to="`/dashboard/albums/${album.id}`">{{ album.fileCount - 5 }}+ more</router-link>
+ <router-link :to="`/dashboard/albums/${album.uuid}`">{{ album.fileCount - 5 }}+ more</router-link>
</div>
</template>
<template v-else>
@@ -263,6 +263,12 @@
@click="createLink(album)">Create new link</button>
{{ album.links.length }} / {{ config.maxLinksPerAlbum }} links created
</div>
+
+ <div class="has-text-left">
+ <button class="button is-danger"
+ style="float: right"
+ @click="promptDeleteAlbum(album.id)">Delete album</button>
+ </div>
</template>
</b-table>
</div>
@@ -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);
}
}
}