Refactored variables from getFromMusicBrainz()
This commit is contained in:
parent
11ec1926cb
commit
a7577c7b2b
1 changed files with 3 additions and 2 deletions
|
@ -37,8 +37,9 @@ function saveUsers() {
|
|||
async function getFromMusicBrainz(mbid) {
|
||||
try {
|
||||
const response = await axios.get(`https://coverartarchive.org/release/${mbid}`);
|
||||
const imageUrlLarge = response.data.images[0]?.thumbnails?.large;
|
||||
const imageUrl = response.data.images[0]?.thumbnails?.['1200'] || imageUrlLarge || '';
|
||||
const imgObjLarge = response.data.images[0]?.thumbnails?.['1200'];
|
||||
const imgObjMid = response.data.images[0]?.thumbnails?.large;
|
||||
const imageUrl = imgObjLarge || imgObjMid || '';
|
||||
return imageUrl;
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue