Fix types on top song request

This commit is contained in:
jeffvli 2023-02-27 12:44:25 -08:00
parent c0a703be7a
commit 92039b95c3

View file

@ -37,6 +37,7 @@ import {
JFSongListResponse, JFSongListResponse,
JFSongListSort, JFSongListSort,
JFCollectionType, JFCollectionType,
JFSortOrder,
} from '/@/renderer/api/jellyfin.types'; } from '/@/renderer/api/jellyfin.types';
import { import {
Album, Album,
@ -74,7 +75,6 @@ import {
ScrobbleArgs, ScrobbleArgs,
RawScrobbleResponse, RawScrobbleResponse,
TopSongListArgs, TopSongListArgs,
SortOrder,
} from '/@/renderer/api/types'; } from '/@/renderer/api/types';
import { useAuthStore } from '/@/renderer/store'; import { useAuthStore } from '/@/renderer/store';
import { ServerListItem, ServerType } from '/@/renderer/types'; import { ServerListItem, ServerType } from '/@/renderer/types';
@ -329,17 +329,17 @@ const getAlbumList = async (args: AlbumListArgs): Promise<JFAlbumList> => {
}; };
}; };
const getTopSongList = async (args: TopSongListArgs): Promise<any> => { const getTopSongList = async (args: TopSongListArgs): Promise<JFSongList> => {
const { signal, server, query } = args; const { signal, server, query } = args;
const searchParams: any = { const searchParams: JFSongListParams = {
artistIds: query.artistId, artistIds: query.artistId,
fields: 'Genres, DateCreated, MediaSources, ParentId', fields: 'Genres, DateCreated, MediaSources, ParentId',
includeItemTypes: 'Audio', includeItemTypes: 'Audio',
limit: query.limit, limit: query.limit,
recursive: true, recursive: true,
sortBy: JFSongListSort.COMMUNITY_RATING, sortBy: JFSongListSort.COMMUNITY_RATING,
sortOrder: SortOrder.DESC, sortOrder: JFSortOrder.DESC,
userId: server?.userId || '', userId: server?.userId || '',
}; };
@ -350,7 +350,7 @@ const getTopSongList = async (args: TopSongListArgs): Promise<any> => {
searchParams: parseSearchParams(searchParams), searchParams: parseSearchParams(searchParams),
signal, signal,
}) })
.json<any>(); .json<JFSongListResponse>();
return { return {
items: data.Items, items: data.Items,