diff --git a/client/pages/collection/_id.vue b/client/pages/collection/_id.vue index 37c9f609..02be207c 100644 --- a/client/pages/collection/_id.vue +++ b/client/pages/collection/_id.vue @@ -51,6 +51,7 @@ export default { if (!collection) { return redirect('/') } + store.commit('user/addUpdateCollection', collection) return { collectionId: collection.id diff --git a/client/pages/library/_library/authors/index.vue b/client/pages/library/_library/authors/index.vue index 686702e1..34e819c1 100644 --- a/client/pages/library/_library/authors/index.vue +++ b/client/pages/library/_library/authors/index.vue @@ -23,11 +23,16 @@ export default { async asyncData({ store, params, redirect, query, app }) { var libraryId = params.library - var library = await store.dispatch('libraries/fetch', libraryId) - if (!library) { + var libraryData = await store.dispatch('libraries/fetch', libraryId) + if (!libraryData) { return redirect('/oops?message=Library not found') } + const library = libraryData.library + if (library.mediaType === 'podcast') { + return redirect(`/library/${libraryId}`) + } + return { libraryId } diff --git a/client/pages/library/_library/bookshelf/_id.vue b/client/pages/library/_library/bookshelf/_id.vue index 30f8b551..8b94747a 100644 --- a/client/pages/library/_library/bookshelf/_id.vue +++ b/client/pages/library/_library/bookshelf/_id.vue @@ -14,8 +14,8 @@ export default { async asyncData({ params, query, store, app, redirect }) { var libraryId = params.library - var library = await store.dispatch('libraries/fetch', libraryId) - if (!library) { + var libraryData = await store.dispatch('libraries/fetch', libraryId) + if (!libraryData) { return redirect('/oops?message=Library not found') } @@ -23,6 +23,13 @@ export default { if (query.filter) { store.dispatch('user/updateUserSettings', { filterBy: query.filter }) } + + // Redirect podcast libraries + const library = libraryData.library + if (library.mediaType === 'podcast' && (params.id === 'collections' || params.id === 'series')) { + return redirect(`/library/${libraryId}`) + } + return { id: params.id || '', libraryId diff --git a/client/pages/library/_library/podcast/search.vue b/client/pages/library/_library/podcast/search.vue index 03b25497..5433b81f 100644 --- a/client/pages/library/_library/podcast/search.vue +++ b/client/pages/library/_library/podcast/search.vue @@ -44,10 +44,17 @@ export default { async asyncData({ params, query, store, app, redirect }) { var libraryId = params.library - var library = await store.dispatch('libraries/fetch', libraryId) - if (!library) { + var libraryData = await store.dispatch('libraries/fetch', libraryId) + if (!libraryData) { return redirect('/oops?message=Library not found') } + + // Redirect book libraries + const library = libraryData.library + if (library.mediaType === 'book') { + return redirect(`/library/${libraryId}`) + } + return { libraryId } diff --git a/client/pages/library/_library/series/_id.vue b/client/pages/library/_library/series/_id.vue index 054f19cf..754b332e 100644 --- a/client/pages/library/_library/series/_id.vue +++ b/client/pages/library/_library/series/_id.vue @@ -14,10 +14,16 @@ export default { async asyncData({ store, params, redirect, query, app }) { var libraryId = params.library - var library = await store.dispatch('libraries/fetch', libraryId) - if (!library) { + var libraryData = await store.dispatch('libraries/fetch', libraryId) + if (!libraryData) { return redirect('/oops?message=Library not found') } + + const library = libraryData.library + if (library.mediaType === 'podcast') { + return redirect(`/library/${libraryId}`) + } + var series = await app.$axios.$get(`/api/series/${params.id}`).catch((error) => { console.error('Failed', error) return false