mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// @ts-nocheck
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { useCustomers } from '@/hooks/query';
|
||||
import { FinancialHeaderLoadingSkeleton } from '../FinancialHeaderLoadingSkeleton';
|
||||
|
||||
const ARAgingSummaryGeneralContext = createContext();
|
||||
|
||||
/**
|
||||
* A/R aging summary general tab provider.
|
||||
*/
|
||||
function ARAgingSummaryGeneralProvider({ ...props }) {
|
||||
// Retrieve the customers list.
|
||||
const {
|
||||
data: { customers },
|
||||
isLoading: isCustomersLoading,
|
||||
} = useCustomers();
|
||||
|
||||
const provider = {
|
||||
customers,
|
||||
isCustomersLoading,
|
||||
};
|
||||
// Loading state.
|
||||
const loading = isCustomersLoading;
|
||||
|
||||
return loading ? (
|
||||
<FinancialHeaderLoadingSkeleton />
|
||||
) : (
|
||||
<ARAgingSummaryGeneralContext.Provider value={provider} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
const useARAgingSummaryGeneralContext = () =>
|
||||
useContext(ARAgingSummaryGeneralContext);
|
||||
|
||||
export { ARAgingSummaryGeneralProvider, useARAgingSummaryGeneralContext };
|
||||
Reference in New Issue
Block a user