mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +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`)
|
return redirect(`/library/${store.state.libraries.currentLibraryId}/authors`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.library) {
|
if (store.state.libraries.currentLibraryId !== author.libraryId || !store.state.libraries.filterData) {
|
||||||
store.commit('libraries/setCurrentLibrary', query.library)
|
await store.dispatch('libraries/fetch', author.libraryId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -54,11 +54,19 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
async asyncData({ params, redirect }) {
|
async asyncData({ params, redirect, store }) {
|
||||||
if (!params.library) {
|
var libraryId = params.library
|
||||||
console.error('No library...', params.library)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
return redirect('/')
|
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 {
|
return {
|
||||||
libraryId: params.library
|
libraryId: params.library
|
||||||
}
|
}
|
||||||
@ -124,10 +132,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.libraryId) {
|
|
||||||
this.$store.commit('libraries/setCurrentLibrary', this.libraryId)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loadInitialDownloadQueue()
|
this.loadInitialDownloadQueue()
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
Loading…
Reference in New Issue
Block a user