[web] Fix the search page source when clicking the search menu

This commit is contained in:
Alain Nussbaumer 2024-04-03 17:46:33 +02:00
parent 4946c0e43c
commit 31661edc03
5 changed files with 9 additions and 13 deletions

View File

@ -134,7 +134,7 @@ export default {
computed: {
search_name: {
get() {
return `search-${this.$store.state.search_source}`
return this.$store.state.search_source
}
},
show_audiobooks() {

View File

@ -7,7 +7,7 @@
<ul>
<li
:class="{
'is-active': $store.state.search_source === 'library'
'is-active': $route.name === 'search-library'
}"
>
<a @click="search_library">
@ -17,7 +17,7 @@
</li>
<li
:class="{
'is-active': $store.state.search_source === 'spotify'
'is-active': $route.name === 'search-spotify'
}"
>
<a @click="search_spotify">
@ -34,8 +34,6 @@
</template>
<script>
import * as types from '@/store/mutation_types'
export default {
name: 'TabsSearch',
props: { query: { default: '', type: String } },
@ -59,7 +57,6 @@ export default {
methods: {
search_library() {
this.$store.commit(types.SEARCH_SOURCE, 'library')
this.$router.push({
name: 'search-library',
query: this.route_query
@ -67,7 +64,6 @@ export default {
},
search_spotify() {
this.$store.commit(types.SEARCH_SOURCE, 'spotify')
this.$router.push({
name: 'search-spotify',
query: this.route_query

View File

@ -77,6 +77,7 @@
</template>
<script>
import * as types from '@/store/mutation_types'
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import { GroupedList } from '@/lib/GroupedList'
import ListAlbums from '@/components/ListAlbums.vue'
@ -146,6 +147,7 @@ export default {
},
mounted() {
this.$store.commit(types.SEARCH_SOURCE, this.$route.name)
this.search(this.$route)
},
@ -155,7 +157,6 @@ export default {
return
}
this.$router.push({
name: 'search-library',
query: {
limit: 3,
offset: 0,
@ -171,7 +172,6 @@ export default {
},
open_search(type) {
this.$router.push({
name: 'search-library',
query: { query: this.$route.query.query, type }
})
},

View File

@ -73,6 +73,7 @@
</template>
<script>
import * as types from '@/store/mutation_types'
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListAlbumsSpotify from '@/components/ListAlbumsSpotify.vue'
import ListArtistsSpotify from '@/components/ListArtistsSpotify.vue'
@ -134,6 +135,7 @@ export default {
},
mounted() {
this.$store.commit(types.SEARCH_SOURCE, this.$route.name)
this.query = this.$route.query
this.search()
},
@ -144,12 +146,11 @@ export default {
return
}
this.$router.push({
name: 'search-spotify',
query: {
limit: 3,
offset: 0,
query: this.search_query,
type: 'track,artist,album,playlist,audiobook,podcast'
type: this.search_types.join()
}
})
this.$refs.search_field.blur()
@ -160,7 +161,6 @@ export default {
},
open_search(type) {
this.$router.push({
name: 'search-spotify',
query: { query: this.$route.query.query, type }
})
},

View File

@ -54,7 +54,7 @@ export default createStore({
},
recent_searches: [],
rss_count: {},
search_source: 'library',
search_source: 'search-library',
settings: {
categories: []
},