2025-05-17 19:12:01 +00:00
|
|
|
import { usePagination } from "@erp/core/hooks";
|
2025-05-20 10:08:24 +00:00
|
|
|
import { PropsWithChildren, createContext, useContext } from "react";
|
2025-05-17 19:12:01 +00:00
|
|
|
|
|
|
|
|
export type IInvoicesContextState = {};
|
|
|
|
|
|
|
|
|
|
export const InvoicesContext = createContext<IInvoicesContextState | null>(null);
|
|
|
|
|
|
|
|
|
|
export const InvoicesProvider = ({ children }: PropsWithChildren) => {
|
|
|
|
|
const [pagination, setPagination] = usePagination();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<InvoicesContext.Provider
|
|
|
|
|
value={{
|
|
|
|
|
pagination,
|
|
|
|
|
setPagination,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2025-05-19 16:39:12 +00:00
|
|
|
{children}
|
2025-05-17 19:12:01 +00:00
|
|
|
</InvoicesContext.Provider>
|
|
|
|
|
);
|
|
|
|
|
};
|
2025-05-20 10:08:24 +00:00
|
|
|
|
|
|
|
|
export const useInvoicesContext = () => {
|
|
|
|
|
const context = useContext(InvoicesContext);
|
|
|
|
|
if (context === null) throw new Error("useInvoices must be used within a InvoicesProvider");
|
|
|
|
|
return context;
|
|
|
|
|
};
|