init
This commit is contained in:
23
src/features/players/queries.ts
Normal file
23
src/features/players/queries.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
import { listPlayers, getPlayer, getUnassociatedPlayers } from "./server";
|
||||
|
||||
const playerKeys = {
|
||||
list: ['players', 'list'] as const,
|
||||
details: (id: string) => ['players', 'details', id] as const,
|
||||
unassociated: ['players','unassociated'] as const,
|
||||
};
|
||||
|
||||
export const playerQueries = {
|
||||
list: () => queryOptions({
|
||||
queryKey: playerKeys.list,
|
||||
queryFn: listPlayers,
|
||||
}),
|
||||
details: (id: string) => queryOptions({
|
||||
queryKey: playerKeys.details(id),
|
||||
queryFn: () => getPlayer({ data: id }),
|
||||
}),
|
||||
unassociated: () => queryOptions({
|
||||
queryKey: playerKeys.unassociated,
|
||||
queryFn: getUnassociatedPlayers,
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user