Merge pull request #4037 from mikiher/route-to-library-if-last-issue-removed

Route from Issues to Library page after last issue was removed
This commit is contained in:
advplyr 2025-02-23 17:00:57 -06:00 committed by GitHub
commit 3d5c02ae7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)