mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
Add initial album artist detail route
This commit is contained in:
parent
55e2a9bf37
commit
9b8bcb05bd
21 changed files with 1000 additions and 27 deletions
23
src/renderer/features/artists/queries/artist-info-query.ts
Normal file
23
src/renderer/features/artists/queries/artist-info-query.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import type { AlbumArtistDetailQuery, RawAlbumArtistDetailResponse } from '/@/renderer/api/types';
|
||||
import type { QueryOptions } from '/@/renderer/lib/react-query';
|
||||
import { useCurrentServer } from '/@/renderer/store';
|
||||
import { api } from '/@/renderer/api';
|
||||
|
||||
export const useAlbumArtistInfo = (query: AlbumArtistDetailQuery, options?: QueryOptions) => {
|
||||
const server = useCurrentServer();
|
||||
|
||||
return useQuery({
|
||||
enabled: !!server?.id && !!query.id,
|
||||
queryFn: ({ signal }) => api.controller.getAlbumArtistDetail({ query, server, signal }),
|
||||
queryKey: queryKeys.albumArtists.detail(server?.id || '', query),
|
||||
select: useCallback(
|
||||
(data: RawAlbumArtistDetailResponse | undefined) =>
|
||||
api.normalize.albumArtistDetail(data, server),
|
||||
[server],
|
||||
),
|
||||
...options,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue