Add initial genre list support

This commit is contained in:
jeffvli 2023-07-31 17:16:48 -07:00
parent 4d5085f230
commit 8029712b55
25 changed files with 968 additions and 41 deletions

View file

@ -17,6 +17,7 @@ import type {
RandomSongListQuery,
LyricsQuery,
LyricSearchQuery,
GenreListQuery,
} from './types';
export const splitPaginatedQuery = (key: any) => {
@ -106,7 +107,18 @@ export const queryKeys: Record<
root: (serverId: string) => [serverId, 'artists'] as const,
},
genres: {
list: (serverId: string) => [serverId, 'genres', 'list'] as const,
list: (serverId: string, query?: GenreListQuery) => {
const { pagination, filter } = splitPaginatedQuery(query);
if (query && pagination) {
return [serverId, 'genres', 'list', filter, pagination] as const;
}
if (query) {
return [serverId, 'genres', 'list', filter] as const;
}
return [serverId, 'genres', 'list'] as const;
},
root: (serverId: string) => [serverId, 'genres'] as const,
},
musicFolders: {