[web] Use named route for the Spotify search page

Switching to named routes in order to reduce future maintenance.
This commit is contained in:
Alain Nussbaumer 2023-07-10 13:58:26 +02:00
parent c6a57a38f9
commit 05486ac7a2
2 changed files with 33 additions and 33 deletions

View File

@ -268,41 +268,41 @@
</template> </template>
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ContentText from '@/templates/ContentText.vue'
import TabsSearch from '@/components/TabsSearch.vue'
import SpotifyListItemTrack from '@/components/SpotifyListItemTrack.vue'
import SpotifyListItemArtist from '@/components/SpotifyListItemArtist.vue'
import SpotifyListItemAlbum from '@/components/SpotifyListItemAlbum.vue'
import SpotifyListItemPlaylist from '@/components/SpotifyListItemPlaylist.vue'
import SpotifyModalDialogTrack from '@/components/SpotifyModalDialogTrack.vue'
import SpotifyModalDialogArtist from '@/components/SpotifyModalDialogArtist.vue'
import SpotifyModalDialogAlbum from '@/components/SpotifyModalDialogAlbum.vue'
import SpotifyModalDialogPlaylist from '@/components/SpotifyModalDialogPlaylist.vue'
import CoverArtwork from '@/components/CoverArtwork.vue'
import SpotifyWebApi from 'spotify-web-api-js'
import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import ContentText from '@/templates/ContentText.vue'
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import CoverArtwork from '@/components/CoverArtwork.vue'
import SpotifyListItemAlbum from '@/components/SpotifyListItemAlbum.vue'
import SpotifyListItemArtist from '@/components/SpotifyListItemArtist.vue'
import SpotifyListItemTrack from '@/components/SpotifyListItemTrack.vue'
import SpotifyListItemPlaylist from '@/components/SpotifyListItemPlaylist.vue'
import SpotifyModalDialogAlbum from '@/components/SpotifyModalDialogAlbum.vue'
import SpotifyModalDialogArtist from '@/components/SpotifyModalDialogArtist.vue'
import SpotifyModalDialogPlaylist from '@/components/SpotifyModalDialogPlaylist.vue'
import SpotifyModalDialogTrack from '@/components/SpotifyModalDialogTrack.vue'
import SpotifyWebApi from 'spotify-web-api-js'
import { VueEternalLoading } from '@ts-pro/vue-eternal-loading' import { VueEternalLoading } from '@ts-pro/vue-eternal-loading'
import webapi from '@/webapi'
import TabsSearch from '@/components/TabsSearch.vue'
const PAGE_SIZE = 50 const PAGE_SIZE = 50
export default { export default {
name: 'SpotifyPageSearch', name: 'PageSearchSpotify',
components: { components: {
ContentWithHeading,
ContentText, ContentText,
TabsSearch, ContentWithHeading,
SpotifyListItemTrack, CoverArtwork,
SpotifyListItemArtist,
SpotifyListItemAlbum, SpotifyListItemAlbum,
SpotifyListItemArtist,
SpotifyListItemPlaylist, SpotifyListItemPlaylist,
SpotifyModalDialogTrack, SpotifyListItemTrack,
SpotifyModalDialogArtist,
SpotifyModalDialogAlbum, SpotifyModalDialogAlbum,
SpotifyModalDialogArtist,
SpotifyModalDialogPlaylist, SpotifyModalDialogPlaylist,
SpotifyModalDialogTrack,
VueEternalLoading, VueEternalLoading,
CoverArtwork TabsSearch
}, },
data() { data() {
@ -491,7 +491,7 @@ export default {
} }
this.$router.push({ this.$router.push({
path: '/search/spotify', name: 'search-spotify',
query: { query: {
type: 'track,artist,album,playlist,audiobook,podcast', type: 'track,artist,album,playlist,audiobook,podcast',
query: this.search_query, query: this.search_query,
@ -504,7 +504,7 @@ export default {
open_search_tracks() { open_search_tracks() {
this.$router.push({ this.$router.push({
path: '/search/spotify', name: 'search-spotify',
query: { query: {
type: 'track', type: 'track',
query: this.$route.query.query query: this.$route.query.query
@ -514,7 +514,7 @@ export default {
open_search_artists() { open_search_artists() {
this.$router.push({ this.$router.push({
path: '/search/spotify', name: 'search-spotify',
query: { query: {
type: 'artist', type: 'artist',
query: this.$route.query.query query: this.$route.query.query
@ -524,7 +524,7 @@ export default {
open_search_albums() { open_search_albums() {
this.$router.push({ this.$router.push({
path: '/search/spotify', name: 'search-spotify',
query: { query: {
type: 'album', type: 'album',
query: this.$route.query.query query: this.$route.query.query
@ -534,7 +534,7 @@ export default {
open_search_playlists() { open_search_playlists() {
this.$router.push({ this.$router.push({
path: '/search/spotify', name: 'search-spotify',
query: { query: {
type: 'playlist', type: 'playlist',
query: this.$route.query.query query: this.$route.query.query

View File

@ -28,13 +28,13 @@ import PagePlaylists from '@/pages/PagePlaylists.vue'
import PagePlaylist from '@/pages/PagePlaylist.vue' import PagePlaylist from '@/pages/PagePlaylist.vue'
import PageRadioStreams from '@/pages/PageRadioStreams.vue' import PageRadioStreams from '@/pages/PageRadioStreams.vue'
import PageSearchLibrary from '@/pages/PageSearchLibrary.vue' import PageSearchLibrary from '@/pages/PageSearchLibrary.vue'
import PageSearchSpotify from '@/pages/PageSearchSpotify.vue'
import SpotifyPageBrowse from '@/pages/SpotifyPageBrowse.vue' import SpotifyPageBrowse from '@/pages/SpotifyPageBrowse.vue'
import SpotifyPageBrowseNewReleases from '@/pages/SpotifyPageBrowseNewReleases.vue' import SpotifyPageBrowseNewReleases from '@/pages/SpotifyPageBrowseNewReleases.vue'
import SpotifyPageBrowseFeaturedPlaylists from '@/pages/SpotifyPageBrowseFeaturedPlaylists.vue' import SpotifyPageBrowseFeaturedPlaylists from '@/pages/SpotifyPageBrowseFeaturedPlaylists.vue'
import SpotifyPageArtist from '@/pages/SpotifyPageArtist.vue' import SpotifyPageArtist from '@/pages/SpotifyPageArtist.vue'
import SpotifyPageAlbum from '@/pages/SpotifyPageAlbum.vue' import SpotifyPageAlbum from '@/pages/SpotifyPageAlbum.vue'
import SpotifyPagePlaylist from '@/pages/SpotifyPagePlaylist.vue' import SpotifyPagePlaylist from '@/pages/SpotifyPagePlaylist.vue'
import SpotifyPageSearch from '@/pages/SpotifyPageSearch.vue'
import SettingsPageWebinterface from '@/pages/SettingsPageWebinterface.vue' import SettingsPageWebinterface from '@/pages/SettingsPageWebinterface.vue'
import SettingsPageArtwork from '@/pages/SettingsPageArtwork.vue' import SettingsPageArtwork from '@/pages/SettingsPageArtwork.vue'
import SettingsPageOnlineServices from '@/pages/SettingsPageOnlineServices.vue' import SettingsPageOnlineServices from '@/pages/SettingsPageOnlineServices.vue'
@ -225,6 +225,11 @@ export const router = createRouter({
name: 'search-library', name: 'search-library',
path: '/search/library' path: '/search/library'
}, },
{
component: PageSearchSpotify,
name: 'search-spotify',
path: '/search/spotify',
},
{ {
path: '/music/spotify', path: '/music/spotify',
name: 'Spotify', name: 'Spotify',
@ -261,11 +266,6 @@ export const router = createRouter({
component: SpotifyPagePlaylist, component: SpotifyPagePlaylist,
meta: { show_progress: true } meta: { show_progress: true }
}, },
{
path: '/search/spotify',
name: 'Spotify Search',
component: SpotifyPageSearch
},
{ {
path: '/settings/webinterface', path: '/settings/webinterface',
name: 'Settings Webinterface', name: 'Settings Webinterface',