mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import FinancialReportPage from '../FinancialReportPage';
|
||||
import { useProfitLossSheet } from 'hooks/query';
|
||||
import { transformFilterFormToQuery } from '../common';
|
||||
|
||||
const ProfitLossSheetContext = createContext();
|
||||
|
||||
function ProfitLossSheetProvider({ query, ...props }) {
|
||||
const {
|
||||
data: profitLossSheet,
|
||||
isFetching,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useProfitLossSheet({
|
||||
...transformFilterFormToQuery(query),
|
||||
});
|
||||
|
||||
const provider = {
|
||||
profitLossSheet,
|
||||
isLoading,
|
||||
isFetching,
|
||||
sheetRefetch: refetch,
|
||||
};
|
||||
|
||||
return (
|
||||
<FinancialReportPage name={'profit-loss-sheet'}>
|
||||
<ProfitLossSheetContext.Provider value={provider} {...props} />
|
||||
</FinancialReportPage>
|
||||
);
|
||||
}
|
||||
|
||||
const useProfitLossSheetContext = () => useContext(ProfitLossSheetContext);
|
||||
|
||||
export { useProfitLossSheetContext, ProfitLossSheetProvider };
|
||||
Reference in New Issue
Block a user