mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Add redirects for media types on unsupported pages
This commit is contained in:
parent
8bbeae4873
commit
cbde451120
@ -51,6 +51,7 @@ export default {
|
|||||||
if (!collection) {
|
if (!collection) {
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
store.commit('user/addUpdateCollection', collection)
|
store.commit('user/addUpdateCollection', collection)
|
||||||
return {
|
return {
|
||||||
collectionId: collection.id
|
collectionId: collection.id
|
||||||
|
@ -23,11 +23,16 @@
|
|||||||
export default {
|
export default {
|
||||||
async asyncData({ store, params, redirect, query, app }) {
|
async asyncData({ store, params, redirect, query, app }) {
|
||||||
var libraryId = params.library
|
var libraryId = params.library
|
||||||
var library = await store.dispatch('libraries/fetch', libraryId)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
if (!library) {
|
if (!libraryData) {
|
||||||
return redirect('/oops?message=Library not found')
|
return redirect('/oops?message=Library not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const library = libraryData.library
|
||||||
|
if (library.mediaType === 'podcast') {
|
||||||
|
return redirect(`/library/${libraryId}`)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryId
|
libraryId
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
export default {
|
export default {
|
||||||
async asyncData({ params, query, store, app, redirect }) {
|
async asyncData({ params, query, store, app, redirect }) {
|
||||||
var libraryId = params.library
|
var libraryId = params.library
|
||||||
var library = await store.dispatch('libraries/fetch', libraryId)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
if (!library) {
|
if (!libraryData) {
|
||||||
return redirect('/oops?message=Library not found')
|
return redirect('/oops?message=Library not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +23,13 @@ export default {
|
|||||||
if (query.filter) {
|
if (query.filter) {
|
||||||
store.dispatch('user/updateUserSettings', { filterBy: 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 {
|
return {
|
||||||
id: params.id || '',
|
id: params.id || '',
|
||||||
libraryId
|
libraryId
|
||||||
|
@ -44,10 +44,17 @@
|
|||||||
export default {
|
export default {
|
||||||
async asyncData({ params, query, store, app, redirect }) {
|
async asyncData({ params, query, store, app, redirect }) {
|
||||||
var libraryId = params.library
|
var libraryId = params.library
|
||||||
var library = await store.dispatch('libraries/fetch', libraryId)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
if (!library) {
|
if (!libraryData) {
|
||||||
return redirect('/oops?message=Library not found')
|
return redirect('/oops?message=Library not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect book libraries
|
||||||
|
const library = libraryData.library
|
||||||
|
if (library.mediaType === 'book') {
|
||||||
|
return redirect(`/library/${libraryId}`)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryId
|
libraryId
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,16 @@
|
|||||||
export default {
|
export default {
|
||||||
async asyncData({ store, params, redirect, query, app }) {
|
async asyncData({ store, params, redirect, query, app }) {
|
||||||
var libraryId = params.library
|
var libraryId = params.library
|
||||||
var library = await store.dispatch('libraries/fetch', libraryId)
|
var libraryData = await store.dispatch('libraries/fetch', libraryId)
|
||||||
if (!library) {
|
if (!libraryData) {
|
||||||
return redirect('/oops?message=Library not found')
|
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) => {
|
var series = await app.$axios.$get(`/api/series/${params.id}`).catch((error) => {
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user