mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
support mbz album detail view
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
import { queryOptions } from '@tanstack/react-query';
|
||||
|
||||
import { getMbzReleaseIdFromAlbumId } from '../../musicbrainz/utils';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { controller } from '/@/renderer/api/controller';
|
||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import { getOptimizedListCount } from '/@/renderer/api/utils-list-count';
|
||||
import { fetchMbzReleaseAsAlbum } from '/@/renderer/features/musicbrainz/api/musicbrainz-api';
|
||||
import { QueryHookArgs } from '/@/renderer/lib/react-query';
|
||||
import { AlbumDetailQuery, AlbumListQuery, ListCountQuery } from '/@/shared/types/domain-types';
|
||||
|
||||
export const albumQueries = {
|
||||
detail: (args: QueryHookArgs<AlbumDetailQuery>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
queryFn: async ({ signal }) => {
|
||||
const mbzReleaseId = getMbzReleaseIdFromAlbumId(args.query.id);
|
||||
|
||||
if (mbzReleaseId !== null) {
|
||||
return fetchMbzReleaseAsAlbum(mbzReleaseId);
|
||||
}
|
||||
|
||||
return api.controller.getAlbumDetail({
|
||||
apiClientProps: { serverId: args.serverId, signal },
|
||||
query: args.query,
|
||||
|
||||
Reference in New Issue
Block a user