mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-11-07 08:34:10 +01:00
Replace setCurrentLibrary calls with fetch to ensure filterData matches library
This commit is contained in:
parent
03818fadee
commit
006241163b
@ -56,8 +56,8 @@ export default {
|
||||
return redirect(`/library/${store.state.libraries.currentLibraryId}/authors`)
|
||||
}
|
||||
|
||||
if (query.library) {
|
||||
store.commit('libraries/setCurrentLibrary', query.library)
|
||||
if (store.state.libraries.currentLibraryId !== author.libraryId || !store.state.libraries.filterData) {
|
||||
await store.dispatch('libraries/fetch', author.libraryId)
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -54,11 +54,19 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
async asyncData({ params, redirect }) {
|
||||
if (!params.library) {
|
||||
console.error('No library...', params.library)
|
||||
return redirect('/')
|
||||
async asyncData({ params, redirect, store }) {
|
||||
var libraryId = params.library
|
||||
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||
if (!libraryData) {
|
||||
return redirect('/oops?message=Library not found')
|
||||
}
|
||||
|
||||
// Redirect book libraries
|
||||
const library = libraryData.library
|
||||
if (library.mediaType === 'book') {
|
||||
return redirect(`/library/${libraryId}`)
|
||||
}
|
||||
|
||||
return {
|
||||
libraryId: params.library
|
||||
}
|
||||
@ -124,10 +132,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.libraryId) {
|
||||
this.$store.commit('libraries/setCurrentLibrary', this.libraryId)
|
||||
}
|
||||
|
||||
this.loadInitialDownloadQueue()
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
Loading…
Reference in New Issue
Block a user