mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import FinancialReportPage from '../FinancialReportPage';
|
||||
import { useInventoryValuation } from 'hooks/query';
|
||||
import { transformFilterFormToQuery } from '../common';
|
||||
|
||||
const InventoryValuationContext = React.createContext();
|
||||
|
||||
function InventoryValuationProvider({ query, ...props }) {
|
||||
const {
|
||||
data: inventoryValuation,
|
||||
isFetching,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useInventoryValuation(
|
||||
{
|
||||
...transformFilterFormToQuery(query),
|
||||
},
|
||||
{
|
||||
keepPreviousData: true,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
// Provider data.
|
||||
const provider = {
|
||||
inventoryValuation,
|
||||
isLoading,
|
||||
isFetching,
|
||||
refetchSheet: refetch,
|
||||
};
|
||||
|
||||
return (
|
||||
<FinancialReportPage name={'inventory-valuation'}>
|
||||
<InventoryValuationContext.Provider value={provider} {...props} />
|
||||
</FinancialReportPage>
|
||||
);
|
||||
}
|
||||
|
||||
const useInventoryValuationContext = () =>
|
||||
React.useContext(InventoryValuationContext);
|
||||
|
||||
export { InventoryValuationProvider, useInventoryValuationContext };
|
||||
Reference in New Issue
Block a user