Update:Changing library while on item page redirects to home

This commit is contained in:
advplyr 2022-08-25 17:58:29 -05:00
parent 79f09b334c
commit 14ff9097c7
2 changed files with 9 additions and 1 deletions

View file

@ -583,13 +583,20 @@ export default {
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
})
}
},
libraryChanged(libraryId) {
if (this.libraryItem.libraryId !== libraryId) {
this.$router.replace('/bookshelf')
}
}
},
mounted() {
this.$eventBus.$on('library-changed', this.libraryChanged)
this.$eventBus.$on('new-local-library-item', this.newLocalLibraryItem)
this.$socket.on('item_updated', this.itemUpdated)
},
beforeDestroy() {
this.$eventBus.$off('library-changed', this.libraryChanged)
this.$eventBus.$off('new-local-library-item', this.newLocalLibraryItem)
this.$socket.off('item_updated', this.itemUpdated)
}