[web] Use named route for podcast page

Switching to named routes in order to reduce future maintenance.
This commit is contained in:
Alain Nussbaumer 2023-07-10 10:03:05 +02:00
parent 72c5172f12
commit 53e132f441
6 changed files with 25 additions and 19 deletions

View File

@ -105,7 +105,7 @@ export default {
open_album(album) {
this.selected_album = album
if (this.media_kind_resolved === 'podcast') {
this.$router.push({ path: '/podcasts/' + album.id })
this.$router.push({ name: 'podcast', params: { id: album.id } })
} else if (this.media_kind_resolved === 'audiobook') {
this.$router.push({ name: 'audiobook', params: { id: album.id } })
} else {

View File

@ -158,7 +158,7 @@ export default {
open_album() {
this.$emit('close')
if (this.media_kind_resolved === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.album.id })
this.$router.push({ name: 'podcast', params: { id: this.album.id } })
} else if (this.media_kind_resolved === 'audiobook') {
this.$router.push({ name: 'audiobook', params: { id: this.album.id } })
} else {

View File

@ -209,7 +209,10 @@ export default {
open_album() {
if (this.media_kind === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.item.album_id })
this.$router.push({
name: 'podcast',
params: { id: this.item.album_id }
})
} else if (this.media_kind === 'audiobook') {
this.$router.push({
name: 'audiobook',

View File

@ -243,7 +243,10 @@ export default {
open_album() {
this.$emit('close')
if (this.track.media_kind === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.track.album_id })
this.$router.push({
name: 'podcast',
params: { id: this.track.album_id }
})
} else if (this.track.media_kind === 'audiobook') {
this.$router.push({
name: 'audiobook',

View File

@ -59,17 +59,17 @@
<script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListTracks from '@/components/ListTracks.vue'
import ModalDialogAlbum from '@/components/ModalDialogAlbum.vue'
import ModalDialog from '@/components/ModalDialog.vue'
import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList'
import ListTracks from '@/components/ListTracks.vue'
import ModalDialog from '@/components/ModalDialog.vue'
import ModalDialogAlbum from '@/components/ModalDialogAlbum.vue'
import webapi from '@/webapi'
const dataObject = {
load(to) {
return Promise.all([
webapi.library_album(to.params.album_id),
webapi.library_podcast_episodes(to.params.album_id)
webapi.library_album(to.params.id),
webapi.library_podcast_episodes(to.params.id)
])
},
@ -84,8 +84,8 @@ export default {
components: {
ContentWithHeading,
ListTracks,
ModalDialogAlbum,
ModalDialog
ModalDialog,
ModalDialogAlbum
},
beforeRouteEnter(to, from, next) {

View File

@ -19,8 +19,8 @@ import PageArtistTracks from '@/pages/PageArtistTracks.vue'
import PageComposers from '@/pages/PageComposers.vue'
import PageComposer from '@/pages/PageComposer.vue'
import PageComposerTracks from '@/pages/PageComposerTracks.vue'
import PagePodcasts from '@/pages/PagePodcasts.vue'
import PagePodcast from '@/pages/PagePodcast.vue'
import PagePodcasts from '@/pages/PagePodcasts.vue'
import PageAudiobooksArtists from '@/pages/PageAudiobooksArtists.vue'
import PageAudiobooksArtist from '@/pages/PageAudiobooksArtist.vue'
import PagePlaylists from '@/pages/PagePlaylists.vue'
@ -153,18 +153,18 @@ export const router = createRouter({
component: PageComposerTracks,
meta: { show_progress: true, has_index: true }
},
{
component: PagePodcast,
meta: { show_progress: true },
name: 'podcast',
path: '/podcast/:id'
},
{
path: '/podcasts',
name: 'Podcasts',
component: PagePodcasts,
meta: { show_progress: true }
},
{
path: '/podcasts/:album_id',
name: 'Podcast',
component: PagePodcast,
meta: { show_progress: true }
},
{
path: '/audiobooks',
redirect: '/audiobooks/artists'