- activities indexes + client_events/client_errors/rollups/alerts collections - global function middleware via createStart; reads skipped on success - actor stash, denial dedup, control-flow error guards - api route logging, auth event overrides, beacon endpoint, web vitals - centralized admin role checks, shared skeletons, award-badges fix - extracted deriveRunState with tests
22 lines
750 B
TypeScript
22 lines
750 B
TypeScript
import { useQueryClient } from "@tanstack/react-query";
|
|
import { useServerMutation } from "@/lib/tanstack-query/hooks/use-server-mutation";
|
|
import { awardManualBadge } from "@/features/badges/server";
|
|
import { badgeKeys } from "@/features/badges/queries";
|
|
|
|
interface AwardManualBadgeInput {
|
|
playerId: string;
|
|
badgeId: string;
|
|
}
|
|
|
|
export default function useAwardManualBadge() {
|
|
const queryClient = useQueryClient();
|
|
|
|
return useServerMutation({
|
|
mutationFn: (data: AwardManualBadgeInput) => awardManualBadge({ data }),
|
|
onSuccess: (_data, { playerId }) => {
|
|
queryClient.invalidateQueries({ queryKey: badgeKeys.playerBadges(playerId) });
|
|
queryClient.invalidateQueries({ queryKey: badgeKeys.allEarnedBadges() });
|
|
},
|
|
});
|
|
}
|