mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 10:14:36 +02:00
Fix:Show only collections for selected library #1130
This commit is contained in:
parent
4cbc8676c6
commit
6f901defd6
3 changed files with 18 additions and 40 deletions
|
@ -41,7 +41,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
newCollectionName: '',
|
||||
processing: false
|
||||
processing: false,
|
||||
collections: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -78,9 +79,6 @@ export default {
|
|||
selectedLibraryItemId() {
|
||||
return this.selectedLibraryItem ? this.selectedLibraryItem.id : null
|
||||
},
|
||||
collections() {
|
||||
return this.$store.state.user.collections || []
|
||||
},
|
||||
sortedCollections() {
|
||||
return this.collections
|
||||
.map((c) => {
|
||||
|
@ -112,7 +110,19 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
loadCollections() {
|
||||
this.$store.dispatch('user/loadCollections')
|
||||
this.processing = true
|
||||
this.$axios
|
||||
.$get(`/api/libraries/${this.currentLibraryId}/collections`)
|
||||
.then((data) => {
|
||||
this.collections = data.results || []
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to get collections', error)
|
||||
this.$toast.error('Failed to load collections')
|
||||
})
|
||||
.finally(() => {
|
||||
this.processing = false
|
||||
})
|
||||
},
|
||||
removeFromCollection(collection) {
|
||||
if (!this.selectedLibraryItemId && !this.selectedBookIds.length) return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue