mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-04 01:17:19 +02:00
Fix manage, chapters edit tracks and library stats page not setting the current library properly #4170
This commit is contained in:
parent
8bea5d83f5
commit
ddcda197b4
@ -221,6 +221,11 @@ export default {
|
|||||||
return redirect('/')
|
return redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch and set library if this items library does not match the current
|
||||||
|
if (store.state.libraries.currentLibraryId !== libraryItem.libraryId || !store.state.libraries.filterData) {
|
||||||
|
await store.dispatch('libraries/fetch', libraryItem.libraryId)
|
||||||
|
}
|
||||||
|
|
||||||
var previousRoute = from ? from.fullPath : null
|
var previousRoute = from ? from.fullPath : null
|
||||||
if (from && from.path === '/login') previousRoute = null
|
if (from && from.path === '/login') previousRoute = null
|
||||||
return {
|
return {
|
||||||
|
@ -103,6 +103,12 @@ export default {
|
|||||||
console.error('No need to edit library item that is 1 file...')
|
console.error('No need to edit library item that is 1 file...')
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch and set library if this items library does not match the current
|
||||||
|
if (store.state.libraries.currentLibraryId !== libraryItem.libraryId || !store.state.libraries.filterData) {
|
||||||
|
await store.dispatch('libraries/fetch', libraryItem.libraryId)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryItem,
|
libraryItem,
|
||||||
files: libraryItem.media.audioFiles ? libraryItem.media.audioFiles.map((af) => ({ ...af, include: !af.exclude })) : []
|
files: libraryItem.media.audioFiles ? libraryItem.media.audioFiles.map((af) => ({ ...af, include: !af.exclude })) : []
|
||||||
|
@ -195,10 +195,15 @@ export default {
|
|||||||
return redirect('/?error=invalid media type')
|
return redirect('/?error=invalid media type')
|
||||||
}
|
}
|
||||||
if (!libraryItem.media.audioFiles.length) {
|
if (!libraryItem.media.audioFiles.length) {
|
||||||
cnosole.error('No audio files')
|
console.error('No audio files')
|
||||||
return redirect('/?error=no audio files')
|
return redirect('/?error=no audio files')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch and set library if this items library does not match the current
|
||||||
|
if (store.state.libraries.currentLibraryId !== libraryItem.libraryId || !store.state.libraries.filterData) {
|
||||||
|
await store.dispatch('libraries/fetch', libraryItem.libraryId)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryItem
|
libraryItem
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,16 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
asyncData({ redirect, store }) {
|
async asyncData({ redirect, store, params }) {
|
||||||
if (!store.getters['user/getIsAdminOrUp']) {
|
if (!store.getters['user/getIsAdminOrUp']) {
|
||||||
redirect('/')
|
redirect('/')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!store.state.libraries.currentLibraryId) {
|
const libraryId = params.library
|
||||||
return redirect('/config')
|
const library = await store.dispatch('libraries/fetch', libraryId)
|
||||||
|
if (!library) {
|
||||||
|
return redirect(`/oops?message=Library "${libraryId}" not found`)
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user