From 4f51e866c41afbf961608296e4a4f55563cd12e3 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 23 Oct 2023 18:51:44 -0700 Subject: [PATCH] refactor: album delete watch Signed-off-by: Varun Patil --- src/components/modal/AlbumDeleteModal.vue | 31 +++++++---------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/components/modal/AlbumDeleteModal.vue b/src/components/modal/AlbumDeleteModal.vue index 9bb6436c..cb0aa7fd 100644 --- a/src/components/modal/AlbumDeleteModal.vue +++ b/src/components/modal/AlbumDeleteModal.vue @@ -44,21 +44,17 @@ export default defineComponent({ data: () => ({ show: false, - user: '', - name: '', }), - watch: { - $route() { - this.refreshParams(); - }, - }, - - mounted() { - this.refreshParams(); - }, - computed: { + user() { + return this.$route.params.user; + }, + + name() { + return this.$route.params.name; + }, + owned() { return this.user === utils.uid; }, @@ -73,11 +69,6 @@ export default defineComponent({ this.show = true; }, - refreshParams() { - this.user = this.$route.params.user ?? String(); - this.name = this.$route.params.name ?? String(); - }, - async save() { try { await client.deleteFile(dav.getAlbumPath(this.user, this.name)); @@ -85,11 +76,7 @@ export default defineComponent({ this.close(); } catch (error) { console.log(error); - showError( - this.t('photos', 'Failed to delete {name}.', { - name: this.name, - }), - ); + showError(this.t('photos', 'Failed to delete {name}.', { name: this.name })); } }, },