Search page: remember whether library or spotify is selected

This commit is contained in:
Ben Willmore 2022-02-26 20:29:30 +00:00 committed by chme
parent a5dd6c4968
commit f484f1194b
3 changed files with 9 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<div class="column is-four-fifths"> <div class="column is-four-fifths">
<div class="tabs is-centered is-small is-toggle is-toggle-rounded"> <div class="tabs is-centered is-small is-toggle is-toggle-rounded">
<ul> <ul>
<li :class="{ 'is-active': $route.path === '/search/library' }"> <li :class="{ 'is-active': $store.state.search_path === '/search/library' }">
<a @click="search_library"> <a @click="search_library">
<span class="icon is-small" <span class="icon is-small"
><i class="mdi mdi-library-books" ><i class="mdi mdi-library-books"
@ -13,7 +13,7 @@
<span class="">Library</span> <span class="">Library</span>
</a> </a>
</li> </li>
<li :class="{ 'is-active': $route.path === '/search/spotify' }"> <li :class="{ 'is-active': $store.state.search_path === '/search/spotify' }">
<a @click="search_spotify"> <a @click="search_spotify">
<span class="icon is-small" <span class="icon is-small"
><i class="mdi mdi-spotify" ><i class="mdi mdi-spotify"
@ -56,15 +56,17 @@ export default {
methods: { methods: {
search_library: function () { search_library: function () {
this.$store.state.search_path = '/search/library'
this.$router.push({ this.$router.push({
path: '/search/library', path: this.$store.state.search_path,
query: this.route_query query: this.route_query
}) })
}, },
search_spotify: function () { search_spotify: function () {
this.$store.state.search_path = '/search/spotify'
this.$router.push({ this.$router.push({
path: '/search/spotify', path: this.$store.state.search_path,
query: this.route_query query: this.route_query
}) })
} }

View File

@ -473,7 +473,7 @@ export default {
} }
this.$router.push({ this.$router.push({
path: '/search/library', path: this.$store.state.search_path,
query: { query: {
type: 'track,artist,album,playlist,audiobook,podcast,composer', type: 'track,artist,album,playlist,audiobook,podcast,composer',
query: this.search_query, query: this.search_query,

View File

@ -49,6 +49,8 @@ export default createStore({
next_id: 1, next_id: 1,
list: [] list: []
}, },
search_path: '/search/library',
recent_searches: [], recent_searches: [],
hide_singles: false, hide_singles: false,