[web] Use named route for the library search page

Switching to named routes in order to reduce future maintenance.
This commit is contained in:
Alain Nussbaumer 2023-07-10 12:10:39 +02:00
parent ed654381b8
commit 87ccdf7723
3 changed files with 26 additions and 25 deletions

View File

@ -30,7 +30,7 @@
<navbar-item-link v-if="is_visible_files" :to="{ path: '/files' }"> <navbar-item-link v-if="is_visible_files" :to="{ path: '/files' }">
<mdicon class="icon" name="folder-open" size="16" /> <mdicon class="icon" name="folder-open" size="16" />
</navbar-item-link> </navbar-item-link>
<navbar-item-link v-if="is_visible_search" :to="{ path: '/search' }"> <navbar-item-link v-if="is_visible_search" :to="{ name: 'search' }">
<mdicon class="icon" name="magnify" size="16" /> <mdicon class="icon" name="magnify" size="16" />
</navbar-item-link> </navbar-item-link>
<div <div
@ -99,7 +99,7 @@
<mdicon class="icon" name="folder-open" size="16" /> <mdicon class="icon" name="folder-open" size="16" />
<b v-text="$t('navigation.files')" /> <b v-text="$t('navigation.files')" />
</navbar-item-link> </navbar-item-link>
<navbar-item-link :to="{ path: '/search' }"> <navbar-item-link :to="{ name: 'search' }">
<mdicon class="icon" name="magnify" size="16" /> <mdicon class="icon" name="magnify" size="16" />
<b v-text="$t('navigation.search')" /> <b v-text="$t('navigation.search')" />
</navbar-item-link> </navbar-item-link>

View File

@ -256,29 +256,29 @@
</template> </template>
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import * as types from '@/store/mutation_types'
import ContentText from '@/templates/ContentText.vue' import ContentText from '@/templates/ContentText.vue'
import TabsSearch from '@/components/TabsSearch.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListTracks from '@/components/ListTracks.vue' import { GroupByList } from '@/lib/GroupByList'
import ListArtists from '@/components/ListArtists.vue'
import ListAlbums from '@/components/ListAlbums.vue' import ListAlbums from '@/components/ListAlbums.vue'
import ListArtists from '@/components/ListArtists.vue'
import ListComposers from '@/components/ListComposers.vue' import ListComposers from '@/components/ListComposers.vue'
import ListPlaylists from '@/components/ListPlaylists.vue' import ListPlaylists from '@/components/ListPlaylists.vue'
import ListTracks from '@/components/ListTracks.vue'
import TabsSearch from '@/components/TabsSearch.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types'
import { GroupByList } from '@/lib/GroupByList'
export default { export default {
name: 'PageSearch', name: 'PageSearchLibrary',
components: { components: {
ContentWithHeading,
ContentText, ContentText,
TabsSearch, ContentWithHeading,
ListTracks,
ListArtists,
ListAlbums, ListAlbums,
ListArtists,
ListComposers,
ListPlaylists, ListPlaylists,
ListComposers ListTracks,
TabsSearch,
}, },
data() { data() {
@ -498,7 +498,7 @@ export default {
open_search_tracks() { open_search_tracks() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'track', type: 'track',
query: this.$route.query.query query: this.$route.query.query
@ -508,7 +508,7 @@ export default {
open_search_artists() { open_search_artists() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'artist', type: 'artist',
query: this.$route.query.query query: this.$route.query.query
@ -518,7 +518,7 @@ export default {
open_search_albums() { open_search_albums() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'album', type: 'album',
query: this.$route.query.query query: this.$route.query.query
@ -528,7 +528,7 @@ export default {
open_search_composers() { open_search_composers() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'tracks', type: 'tracks',
query: this.$route.query.query query: this.$route.query.query
@ -538,7 +538,7 @@ export default {
open_search_playlists() { open_search_playlists() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'playlist', type: 'playlist',
query: this.$route.query.query query: this.$route.query.query
@ -548,7 +548,7 @@ export default {
open_search_audiobooks() { open_search_audiobooks() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'audiobook', type: 'audiobook',
query: this.$route.query.query query: this.$route.query.query
@ -558,7 +558,7 @@ export default {
open_search_podcasts() { open_search_podcasts() {
this.$router.push({ this.$router.push({
path: '/search/library', name: 'search-library',
query: { query: {
type: 'podcast', type: 'podcast',
query: this.$route.query.query query: this.$route.query.query

View File

@ -27,7 +27,7 @@ import PagePlaylists from '@/pages/PagePlaylists.vue'
import PagePlaylist from '@/pages/PagePlaylist.vue' import PagePlaylist from '@/pages/PagePlaylist.vue'
import PageFiles from '@/pages/PageFiles.vue' import PageFiles from '@/pages/PageFiles.vue'
import PageRadioStreams from '@/pages/PageRadioStreams.vue' import PageRadioStreams from '@/pages/PageRadioStreams.vue'
import PageSearch from '@/pages/PageSearch.vue' import PageSearchLibrary from '@/pages/PageSearchLibrary.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'
@ -216,13 +216,14 @@ export const router = createRouter({
path: '/' path: '/'
}, },
{ {
name: 'search',
path: '/search', path: '/search',
redirect: '/search/library' redirect: '/search/library'
}, },
{ {
path: '/search/library', component: PageSearchLibrary,
name: 'Search Library', name: 'search-library',
component: PageSearch path: '/search/library'
}, },
{ {
path: '/music/spotify', path: '/music/spotify',