regionals
This commit is contained in:
@@ -7,8 +7,8 @@ export const playerKeys = {
|
||||
details: (id: string) => ['players', 'details', id],
|
||||
unassociated: ['players','unassociated'],
|
||||
unenrolled: (tournamentId: string) => ['players', 'unenrolled', tournamentId],
|
||||
stats: (id: string) => ['players', 'stats', id],
|
||||
allStats: ['players', 'stats', 'all'],
|
||||
stats: (id: string, viewType?: 'all' | 'mainline' | 'regional') => ['players', 'stats', id, viewType ?? 'all'],
|
||||
allStats: (viewType?: 'all' | 'mainline' | 'regional') => ['players', 'stats', 'all', viewType ?? 'all'],
|
||||
matches: (id: string) => ['players', 'matches', id],
|
||||
activity: ['players', 'activity'],
|
||||
};
|
||||
@@ -34,13 +34,13 @@ export const playerQueries = {
|
||||
queryKey: playerKeys.unenrolled(tournamentId),
|
||||
queryFn: async () => await getUnenrolledPlayers({ data: tournamentId })
|
||||
}),
|
||||
stats: (id: string) => ({
|
||||
queryKey: playerKeys.stats(id),
|
||||
queryFn: async () => await getPlayerStats({ data: id })
|
||||
stats: (id: string, viewType?: 'all' | 'mainline' | 'regional') => ({
|
||||
queryKey: playerKeys.stats(id, viewType),
|
||||
queryFn: async () => await getPlayerStats({ data: { playerId: id, viewType } })
|
||||
}),
|
||||
allStats: () => ({
|
||||
queryKey: playerKeys.allStats,
|
||||
queryFn: async () => await getAllPlayerStats()
|
||||
allStats: (viewType?: 'all' | 'mainline' | 'regional') => ({
|
||||
queryKey: playerKeys.allStats(viewType),
|
||||
queryFn: async () => await getAllPlayerStats({ data: viewType })
|
||||
}),
|
||||
matches: (id: string) => ({
|
||||
queryKey: playerKeys.matches(id),
|
||||
@@ -84,11 +84,11 @@ export const usePlayers = () =>
|
||||
export const useUnassociatedPlayers = () =>
|
||||
useServerSuspenseQuery(playerQueries.unassociated());
|
||||
|
||||
export const usePlayerStats = (id: string) =>
|
||||
useServerSuspenseQuery(playerQueries.stats(id));
|
||||
export const usePlayerStats = (id: string, viewType?: 'all' | 'mainline' | 'regional') =>
|
||||
useServerSuspenseQuery(playerQueries.stats(id, viewType));
|
||||
|
||||
export const useAllPlayerStats = () =>
|
||||
useServerSuspenseQuery(playerQueries.allStats());
|
||||
export const useAllPlayerStats = (viewType?: 'all' | 'mainline' | 'regional') =>
|
||||
useServerSuspenseQuery(playerQueries.allStats(viewType));
|
||||
|
||||
export const usePlayerMatches = (id: string) =>
|
||||
useServerSuspenseQuery(playerQueries.matches(id));
|
||||
|
||||
Reference in New Issue
Block a user