mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	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:
		
						commit
						3d5c02ae7c
					
				@ -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) {
 | 
					    libraryItemRemoved(libraryItem) {
 | 
				
			||||||
      if (this.entityName === 'items' || this.entityName === 'series-books') {
 | 
					      if (this.entityName === 'items' || this.entityName === 'series-books') {
 | 
				
			||||||
        var indexOf = this.entities.findIndex((ent) => ent && ent.id === libraryItem.id)
 | 
					        var indexOf = this.entities.findIndex((ent) => ent && ent.id === libraryItem.id)
 | 
				
			||||||
@ -578,6 +590,7 @@ export default {
 | 
				
			|||||||
          this.executeRebuild()
 | 
					          this.executeRebuild()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      this.routeToBookshelfIfLastIssueRemoved()
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    libraryItemsAdded(libraryItems) {
 | 
					    libraryItemsAdded(libraryItems) {
 | 
				
			||||||
      console.log('items added', libraryItems)
 | 
					      console.log('items added', libraryItems)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user