[web] Fix the error when the library search only contains the keyword query:

The check for a valid query is not yet implemented though.
This commit is contained in:
Alain Nussbaumer 2024-03-21 20:57:46 +01:00
parent db4e145080
commit a34e14f483

View File

@ -312,7 +312,7 @@ export default {
methods: {
search(route) {
this.search_query = route.query.query?.trim()
if (!this.search_query) {
if (!this.search_query || !this.search_query.replace(/^query:/u, '')) {
this.$refs.search_field.focus()
return
}
@ -325,11 +325,11 @@ export default {
searchMusic(query) {
if (
query.type.indexOf('track') < 0 &&
query.type.indexOf('artist') < 0 &&
query.type.indexOf('album') < 0 &&
query.type.indexOf('playlist') < 0 &&
query.type.indexOf('composer') < 0
!query.type.includes('track') &&
!query.type.includes('artist') &&
!query.type.includes('album') &&
!query.type.includes('playlist') &&
!query.type.includes('composer')
) {
return
}
@ -337,7 +337,7 @@ export default {
type: query.type
}
if (query.query.startsWith('query:')) {
searchParams.expression = `${query.query.replace(/^query:/u, '').trim()} and media_kind is music`
searchParams.expression = `(${query.query.replace(/^query:/u, '').trim()}) and media_kind is music`
} else {
searchParams.query = query.query
searchParams.media_kind = 'music'
@ -356,7 +356,7 @@ export default {
},
searchAudiobooks(query) {
if (query.type.indexOf('audiobook') < 0) {
if (!query.type.includes('audiobook')) {
return
}
const parameters = {
@ -378,7 +378,7 @@ export default {
},
searchPodcasts(query) {
if (query.type.indexOf('podcast') < 0) {
if (!query.type.includes('podcast')) {
return
}
const parameters = {