[web] Fix for unexpected calls to the API #1688

Lyrics feature doesn't mess anymore when the user is playing tracks from Spotify
This commit is contained in:
Alain Nussbaumer
2023-11-24 13:58:30 +01:00
parent f19e9fb48b
commit 91c1e5b174
4 changed files with 31 additions and 42 deletions

View File

@@ -305,13 +305,14 @@ export default {
},
update_lyrics() {
let track = this.$store.state.queue.items.filter(
(e) => e.id == this.$store.state.player.item_id
)
if (track.length >= 1)
webapi.library_track(track[0].track_id).then(({ data }) => {
const track = this.$store.getters.now_playing
if (track && track.track_id) {
webapi.library_track(track.track_id).then(({ data }) => {
this.$store.commit(types.UPDATE_LYRICS, data)
})
} else {
this.$store.commit(types.UPDATE_LYRICS)
}
},
update_settings() {