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;
|
|
|
|
|
};
|