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 { PENALTY_SERVICE_TOKEN } from '@/lib/di/tokens';
|
||||
|
||||
export function usePenaltyMutation() {
|
||||
const penaltyService = useInject(PENALTY_SERVICE_TOKEN);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const applyPenaltyMutation = useMutation({
|
||||
mutationFn: (command: any) => penaltyService.applyPenalty(command),
|
||||
onSuccess: () => {
|
||||
// Invalidate relevant queries to refresh data
|
||||
queryClient.invalidateQueries({ queryKey: ['leagueStewardingData'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['penalties'] });
|
||||
},
|
||||
});
|
||||
|
||||
return applyPenaltyMutation;
|
||||
}
|
||||
Reference in New Issue
Block a user