UNPKG

@b3dotfun/anyspend-sdk

Version:

React Hooks and UI Components for AnySpend by B3

21 lines (18 loc) 683 B
import { useQuery } from "@tanstack/react-query"; import { anyspendService } from "../services/anyspend"; import { useMemo } from "react"; export function useStripeClientSecret(isMainnet: boolean, paymentIntentId: string) { const { data, isLoading, error, refetch } = useQuery({ queryKey: ["stripeClientSecret", isMainnet, paymentIntentId], queryFn: () => anyspendService.getStripeClientSecret(isMainnet, paymentIntentId) }); return useMemo( () => ({ clientSecret: data || null, isLoadingStripeClientSecret: isLoading, stripeClientSecretError: error, refetchStripeClientSecret: refetch }), [data, isLoading, error, refetch] ); }