mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-30 06:39:37 +02:00
Fix:Set next accessible library when currently selected library is removed
This commit is contained in:
parent
049ae73d74
commit
ceb163570f
2 changed files with 34 additions and 1 deletions
|
@ -29,6 +29,19 @@ export const getters = {
|
|||
var library = state.libraries.find(l => l.id === libraryId)
|
||||
if (!library) return null
|
||||
return library.provider
|
||||
},
|
||||
getNextAccessibleLibrary: (state, getters, rootState, rootGetters) => {
|
||||
var librariesSorted = getters['getSortedLibraries']()
|
||||
if (!librariesSorted.length) return null
|
||||
|
||||
var canAccessAllLibraries = rootGetters['user/getUserCanAccessAllLibraries']
|
||||
var userAccessibleLibraries = rootGetters['user/getLibrariesAccessible']
|
||||
if (canAccessAllLibraries) return librariesSorted[0]
|
||||
librariesSorted = librariesSorted.filter((lib) => {
|
||||
return userAccessibleLibraries.includes(lib.id)
|
||||
})
|
||||
if (!librariesSorted.length) return null
|
||||
return librariesSorted[0]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue