[web] Simplify method artwork_url

This commit is contained in:
Alain Nussbaumer 2024-02-28 14:35:03 +01:00
parent 1936ce6621
commit 8aa2b3d5ac
5 changed files with 9 additions and 24 deletions

View File

@ -7,7 +7,7 @@
<div class="card">
<div class="card-content">
<cover-artwork
:artwork_url="artwork_url"
:artwork_url="artwork_url(album)"
:artist="album.artist"
:album="album.name"
class="fd-has-shadow fd-cover fd-cover-normal-image mb-5"
@ -104,11 +104,8 @@ export default {
},
computed: {
artwork_url() {
if (this.album.images && this.album.images.length > 0) {
return this.album.images[0].url
}
return ''
artwork_url(album) {
return album.images?.[0]?.url || ''
}
},

View File

@ -25,7 +25,7 @@
</template>
<template #heading-right>
<cover-artwork
:artwork_url="artwork_url"
:artwork_url="artwork_url(album)"
:artist="album.artist"
:album="album.name"
class="is-clickable fd-has-shadow fd-cover fd-cover-medium-image"
@ -129,11 +129,8 @@ export default {
},
computed: {
artwork_url() {
if (this.album.images && this.album.images.length > 0) {
return this.album.images[0].url
}
return ''
artwork_url(album) {
return album.images?.[0]?.url || ''
}
},

View File

@ -211,10 +211,7 @@ export default {
},
artwork_url(album) {
if (album.images && album.images.length > 0) {
return album.images[0].url
}
return ''
return album.images?.[0]?.url || ''
}
}
}

View File

@ -128,10 +128,7 @@ export default {
},
artwork_url(album) {
if (album.images && album.images.length > 0) {
return album.images[0].url
}
return ''
return album.images?.[0]?.url || ''
}
}
}

View File

@ -405,10 +405,7 @@ export default {
methods: {
artwork_url(album) {
if (album.images && album.images.length > 0) {
return album.images[0].url
}
return ''
return album.images?.[0]?.url || ''
},
new_search() {
if (!this.search_query) {