mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
Add album artist list route
This commit is contained in:
parent
185175aa89
commit
24af17b8fe
19 changed files with 1269 additions and 32 deletions
|
|
@ -0,0 +1,22 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import type { AlbumArtistListQuery, RawAlbumArtistListResponse } from '/@/renderer/api/types';
|
||||
import type { QueryOptions } from '/@/renderer/lib/react-query';
|
||||
import { useCurrentServer } from '/@/renderer/store';
|
||||
import { api } from '/@/renderer/api';
|
||||
|
||||
export const useAlbumArtistList = (query: AlbumArtistListQuery, options?: QueryOptions) => {
|
||||
const server = useCurrentServer();
|
||||
|
||||
return useQuery({
|
||||
enabled: !!server?.id,
|
||||
queryFn: ({ signal }) => api.controller.getAlbumArtistList({ query, server, signal }),
|
||||
queryKey: queryKeys.albumArtists.list(server?.id || '', query),
|
||||
select: useCallback(
|
||||
(data: RawAlbumArtistListResponse | undefined) => api.normalize.albumArtistList(data, server),
|
||||
[server],
|
||||
),
|
||||
...options,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue