fix artists not saving on home + showing as unknown
This commit is contained in:
parent
c0543b15a5
commit
2fd16c7366
1 changed files with 9 additions and 4 deletions
13
js/api.js
13
js/api.js
|
|
@ -384,18 +384,23 @@ export class LosslessAPI {
|
|||
this.fetchWithRetry(`/artist/?f=${artistId}`)
|
||||
]);
|
||||
|
||||
const primaryData = await primaryResponse.json();
|
||||
const rawArtist = Array.isArray(primaryData) ? primaryData[0] : primaryData;
|
||||
const primaryJsonData = await primaryResponse.json();
|
||||
|
||||
// Unwrap data property if it exists, then unwrap artist property if it exists
|
||||
let primaryData = primaryJsonData.data || primaryJsonData;
|
||||
const rawArtist = primaryData.artist || (Array.isArray(primaryData) ? primaryData[0] : primaryData);
|
||||
|
||||
if (!rawArtist) throw new Error('Primary artist details not found.');
|
||||
|
||||
const artist = {
|
||||
...this.prepareArtist(rawArtist),
|
||||
picture: rawArtist.picture || null,
|
||||
picture: rawArtist.picture || primaryData.cover || null,
|
||||
name: rawArtist.name || 'Unknown Artist'
|
||||
};
|
||||
|
||||
const contentData = await contentResponse.json();
|
||||
const contentJsonData = await contentResponse.json();
|
||||
// Unwrap data property if it exists
|
||||
const contentData = contentJsonData.data || contentJsonData;
|
||||
const entries = Array.isArray(contentData) ? contentData : [contentData];
|
||||
|
||||
const albumMap = new Map();
|
||||
|
|
|
|||
Loading…
Reference in a new issue