Additional refactor for navidrome api controller types

This commit is contained in:
jeffvli 2023-04-30 17:55:23 -07:00
parent b9d5447b4f
commit 40aabd2217
7 changed files with 53 additions and 48 deletions

View file

@ -55,7 +55,7 @@ const authenticate = async (
};
}
await ssApiClient({ url: cleanServerUrl }).authenticate({
await ssApiClient({ server: null, url: cleanServerUrl }).authenticate({
query: {
c: 'Feishin',
f: 'json',
@ -261,9 +261,11 @@ const getTopSongList = async (args: TopSongListArgs): Promise<SongListResponse>
}
return {
items: res.body.topSongs.song.map((song) => ssNormalize.song(song, apiClientProps.server, '')),
items:
res.body.topSongs?.song?.map((song) => ssNormalize.song(song, apiClientProps.server, '')) ||
[],
startIndex: 0,
totalRecordCount: res.body.topSongs.song.length || 0,
totalRecordCount: res.body.topSongs?.song?.length || 0,
};
};