FactuGES_ERP/modules/invoices/src/web/hooks/invoices-context.tsx

12 lines
326 B
TypeScript
Raw Normal View History

2025-06-11 13:13:21 +00:00
import { useContext } from "react";
import { InvoicesContext, InvoicesContextType } from "../context";
2025-05-17 19:12:01 +00:00
2025-06-11 13:13:21 +00:00
export const useInvoices = (): InvoicesContextType => {
2025-05-20 10:08:24 +00:00
const context = useContext(InvoicesContext);
2025-06-11 13:13:21 +00:00
if (!context) {
throw new Error("useInvoices must be used within a InvoicesProvider");
}
2025-05-20 10:08:24 +00:00
return context;
};