From 6c0e42db49067e05af263501a9d6d79aa4a95678 Mon Sep 17 00:00:00 2001 From: mikiher Date: Sun, 23 Feb 2025 18:06:36 +0200 Subject: [PATCH] Route from Issues to Library if last issue is removed --- client/components/app/LazyBookshelf.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/components/app/LazyBookshelf.vue b/client/components/app/LazyBookshelf.vue index 2144b899..f5601a95 100644 --- a/client/components/app/LazyBookshelf.vue +++ b/client/components/app/LazyBookshelf.vue @@ -568,6 +568,18 @@ export default { } } }, + routeToBookshelfIfLastIssueRemoved() { + if (this.totalEntities === 0) { + const currentRouteQuery = this.$route.query + if (currentRouteQuery?.filter && currentRouteQuery.filter === 'issues') { + this.$nextTick(() => { + console.log('Last issue removed. Redirecting to library bookshelf') + this.$router.push(`/library/${this.currentLibraryId}/bookshelf`) + this.$store.dispatch('libraries/fetch', this.currentLibraryId) + }) + } + } + }, libraryItemRemoved(libraryItem) { if (this.entityName === 'items' || this.entityName === 'series-books') { var indexOf = this.entities.findIndex((ent) => ent && ent.id === libraryItem.id) @@ -578,6 +590,7 @@ export default { this.executeRebuild() } } + this.routeToBookshelfIfLastIssueRemoved() }, libraryItemsAdded(libraryItems) { console.log('items added', libraryItems)