import { useMutation, useQueryClient } from "@tanstack/react-query"; import { getMillis } from "taehui-ts/date"; import { wwwAPI } from "@/utilities/wwwAPI"; export default function usePostHit() { const queryClient = useQueryClient(); return useMutation({ mutationFn: async () => { const { data } = await wwwAPI.post("/hit", null, { headers: { millis: getMillis(), }, }); return data; }, onSuccess: async () => { await queryClient.invalidateQueries({ queryKey: ["hit"] }); }, }); }