Add code to store search query and perform search

This commit is contained in:
Jakob Moser 2025-11-13 00:20:02 +01:00
parent 5066ce695d
commit ef6e52c0cb
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -0,0 +1,10 @@
export default {
query: null,
apply(songs) {
const normalizedQuery = this.query?.trim()?.toLowerCase()
return normalizedQuery ? songs?.filter(
song => song.title?.toLowerCase()?.includes(normalizedQuery) || song.artist?.toLowerCase()?.includes(normalizedQuery)
) : songs
}
}