import { useMutation, useQueryClient } from "@tanstack/react-query";
import { sendUserMessage } from "../api/client";

export function useSendUserMessage() {
	const queryClient = useQueryClient();

	return useMutation({
		mutationFn: sendUserMessage,
		onSuccess: () => {
			queryClient.invalidateQueries({ queryKey: ["users", "message-queue"] });
		},
	});
}
