TanStackT
TanStack2y ago
1 reply
skinny-azure

in useMutation, how to get error status code inside onError?

  const {
    data: getPricingData,
    isPending,
    mutate,
  } = useMutation({
    mutationKey: ['get-pricing'],
    mutationFn: () => fetchPricing(),
    onError: (error) => {
      console.log(error);
    },
  });


I want to access the error status code.
Was this page helpful?