mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 04:20:07 +02:00
add new genre list
This commit is contained in:
@@ -3,7 +3,7 @@ import { queryOptions } from '@tanstack/react-query';
|
||||
import { api } from '/@/renderer/api';
|
||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import { QueryHookArgs } from '/@/renderer/lib/react-query';
|
||||
import { GenreListQuery } from '/@/shared/types/domain-types';
|
||||
import { GenreListQuery, ListCountQuery } from '/@/shared/types/domain-types';
|
||||
|
||||
export const genresQueries = {
|
||||
list: (args: QueryHookArgs<GenreListQuery>) => {
|
||||
@@ -19,4 +19,21 @@ export const genresQueries = {
|
||||
...args.options,
|
||||
});
|
||||
},
|
||||
listCount: (args: QueryHookArgs<ListCountQuery<GenreListQuery>>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
return api.controller
|
||||
.getGenreList({
|
||||
apiClientProps: { serverId: args.serverId, signal },
|
||||
query: { ...args.query, limit: 1, startIndex: 0 },
|
||||
})
|
||||
.then((result) => result?.totalRecordCount ?? 0);
|
||||
},
|
||||
queryKey: queryKeys.genres.count(
|
||||
args.serverId,
|
||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||
),
|
||||
...args.options,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user