mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Fix:Collection page set library on refresh
This commit is contained in:
parent
084bea6b15
commit
c1360267c6
@ -52,6 +52,11 @@ export default {
|
|||||||
return redirect('/')
|
return redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If collection is a different library then set library as current
|
||||||
|
if (collection.libraryId !== store.state.libraries.currentLibraryId) {
|
||||||
|
await store.dispatch('libraries/fetch', collection.libraryId)
|
||||||
|
}
|
||||||
|
|
||||||
store.commit('libraries/addUpdateCollection', collection)
|
store.commit('libraries/addUpdateCollection', collection)
|
||||||
return {
|
return {
|
||||||
collectionId: collection.id
|
collectionId: collection.id
|
||||||
@ -87,7 +92,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
streaming() {
|
streaming() {
|
||||||
return !!this.playableBooks.find((b) => b.id === this.$store.getters['getLibraryItemIdStreaming'])
|
return !!this.playableBooks.some((b) => b.id === this.$store.getters['getLibraryItemIdStreaming'])
|
||||||
},
|
},
|
||||||
showPlayButton() {
|
showPlayButton() {
|
||||||
return this.playableBooks.length
|
return this.playableBooks.length
|
||||||
@ -109,14 +114,15 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.$delete(`/api/collections/${this.collection.id}`)
|
.$delete(`/api/collections/${this.collection.id}`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.processingRemove = false
|
|
||||||
this.$toast.success(this.$strings.ToastCollectionRemoveSuccess)
|
this.$toast.success(this.$strings.ToastCollectionRemoveSuccess)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed to remove collection', error)
|
console.error('Failed to remove collection', error)
|
||||||
this.processingRemove = false
|
|
||||||
this.$toast.error(this.$strings.ToastCollectionRemoveFailed)
|
this.$toast.error(this.$strings.ToastCollectionRemoveFailed)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.processingRemove = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clickPlay() {
|
clickPlay() {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
async asyncData({ params, query, store, app, redirect }) {
|
async asyncData({ params, query, store, redirect }) {
|
||||||
var libraryId = params.library
|
var libraryId = params.library
|
||||||
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
if (!libraryData) {
|
if (!libraryData) {
|
||||||
|
Loading…
Reference in New Issue
Block a user