reactions, match sse, etc
This commit is contained in:
18
src/features/matches/queries.ts
Normal file
18
src/features/matches/queries.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useServerSuspenseQuery, useServerQuery } from "@/lib/tanstack-query/hooks";
|
||||
import { getMatchReactions } from "./server";
|
||||
|
||||
export const matchKeys = {
|
||||
list: ['matches', 'list'] as const,
|
||||
details: (id: string) => ['matches', 'details', id] as const,
|
||||
reactions: (id: string) => ['matches', 'reactions', id] as const,
|
||||
};
|
||||
|
||||
export const matchQueries = {
|
||||
reactions: (matchId: string) => ({
|
||||
queryKey: matchKeys.reactions(matchId),
|
||||
queryFn: () => getMatchReactions({ data: matchId }),
|
||||
}),
|
||||
};
|
||||
|
||||
export const useMatchReactions = (matchId: string) =>
|
||||
useServerQuery(matchQueries.reactions(matchId));
|
||||
Reference in New Issue
Block a user