import { useContext } from "react";
import { CustomerInvoicesContext, CustomerInvoicesContextType } from "../context";

export const useCustomerInvoicesContext = (): CustomerInvoicesContextType => {
  const context = useContext(CustomerInvoicesContext);
  if (!context) {
    throw new Error("useCustomerInvoices must be used within a CustomerInvoicesProvider");
  }

  return context;
};
