di usage in website
This commit is contained in:
16
apps/website/hooks/protest/useLeagueProtests.ts
Normal file
16
apps/website/hooks/protest/useLeagueProtests.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useInject } from '@/lib/di/hooks/useInject';
|
||||
import { PROTEST_SERVICE_TOKEN } from '@/lib/di/tokens';
|
||||
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
|
||||
|
||||
export function useLeagueProtests(leagueId: string) {
|
||||
const protestService = useInject(PROTEST_SERVICE_TOKEN);
|
||||
|
||||
const queryResult = useQuery({
|
||||
queryKey: ['leagueProtests', leagueId],
|
||||
queryFn: () => protestService.getLeagueProtests(leagueId),
|
||||
enabled: !!leagueId,
|
||||
});
|
||||
|
||||
return enhanceQueryResult(queryResult);
|
||||
}
|
||||
Reference in New Issue
Block a user