mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-15 04:51:06 +02:00
refactor api controller to internalize server fetch
This commit is contained in:
@@ -3,7 +3,6 @@ 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 { getServerById } from '/@/renderer/store';
|
||||
import { SearchQuery } from '/@/shared/types/domain-types';
|
||||
|
||||
export const searchQueries = {
|
||||
@@ -11,11 +10,11 @@ export const searchQueries = {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
return api.controller.search({
|
||||
apiClientProps: { server: getServerById(args.serverId), signal },
|
||||
apiClientProps: { serverId: args.serverId, signal },
|
||||
query: args.query,
|
||||
});
|
||||
},
|
||||
queryKey: queryKeys.search.list(args.serverId || '', args.query),
|
||||
queryKey: queryKeys.search.list(args.serverId, args.query),
|
||||
...args.options,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user