2021-09-23 03:40:35 +02:00
|
|
|
<template>
|
2022-03-14 01:34:31 +01:00
|
|
|
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
|
2022-10-29 00:27:06 +02:00
|
|
|
<app-book-shelf-toolbar :page="id || ''" />
|
|
|
|
<app-lazy-bookshelf :page="id || ''" />
|
2021-09-23 03:40:35 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-11-27 21:22:46 +01:00
|
|
|
async asyncData({ params, query, store, redirect }) {
|
2021-10-05 05:11:42 +02:00
|
|
|
var libraryId = params.library
|
2022-04-14 19:57:34 +02:00
|
|
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
|
|
|
if (!libraryData) {
|
2021-10-05 05:11:42 +02:00
|
|
|
return redirect('/oops?message=Library not found')
|
|
|
|
}
|
|
|
|
|
2022-10-29 18:17:51 +02:00
|
|
|
// Set series sort by
|
2022-12-17 22:10:25 +01:00
|
|
|
if (query.filter || query.sort || query.desc) {
|
|
|
|
const isSeries = params.id === 'series'
|
|
|
|
const settingsUpdate = {
|
|
|
|
[isSeries ? 'seriesFilterBy' : 'filterBy']: query.filter || undefined,
|
|
|
|
[isSeries ? 'seriesSortBy' : 'orderBy']: query.sort || undefined,
|
|
|
|
[isSeries ? 'seriesSortDesc' : 'orderDesc']: query.desc == '0' ? false : query.desc == '1' ? true : undefined
|
2022-10-29 22:33:38 +02:00
|
|
|
}
|
2022-12-17 22:10:25 +01:00
|
|
|
store.dispatch('user/updateUserSettings', settingsUpdate)
|
2021-09-24 14:32:38 +02:00
|
|
|
}
|
2022-04-14 19:57:34 +02:00
|
|
|
|
|
|
|
// Redirect podcast libraries
|
|
|
|
const library = libraryData.library
|
2024-10-06 17:25:08 +02:00
|
|
|
if (library.mediaType === 'podcast' && (params.id === 'collections' || params.id === 'series' || params.id === 'authors')) {
|
2022-04-14 19:57:34 +02:00
|
|
|
return redirect(`/library/${libraryId}`)
|
|
|
|
}
|
|
|
|
|
2021-09-23 03:40:35 +02:00
|
|
|
return {
|
2021-12-02 02:07:03 +01:00
|
|
|
id: params.id || '',
|
|
|
|
libraryId
|
2021-09-23 03:40:35 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
2022-10-29 00:27:06 +02:00
|
|
|
return {}
|
2021-09-23 03:40:35 +02:00
|
|
|
},
|
|
|
|
computed: {
|
2022-03-14 01:34:31 +01:00
|
|
|
streamLibraryItem() {
|
|
|
|
return this.$store.state.streamLibraryItem
|
2021-09-23 03:40:35 +02:00
|
|
|
}
|
|
|
|
},
|
2021-12-02 02:07:03 +01:00
|
|
|
methods: {}
|
2021-09-23 03:40:35 +02:00
|
|
|
}
|
2022-09-02 03:03:41 +02:00
|
|
|
</script>
|