website refactor
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useInject } from '@/lib/di/hooks/useInject';
|
||||
import { LEAGUE_SERVICE_TOKEN } from '@/lib/di/tokens';
|
||||
|
||||
export function useCreateLeague() {
|
||||
const leagueService = useInject(LEAGUE_SERVICE_TOKEN);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const createLeagueMutation = useMutation({
|
||||
mutationFn: (input: any) => leagueService.createLeague(input),
|
||||
onSuccess: () => {
|
||||
// Invalidate relevant queries to refresh data
|
||||
queryClient.invalidateQueries({ queryKey: ['allLeagues'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['leagueMemberships'] });
|
||||
},
|
||||
});
|
||||
|
||||
return createLeagueMutation;
|
||||
}
|
||||
Reference in New Issue
Block a user