import React from 'react'; import { DrawerHeaderContent, DrawerLoading } from 'components'; import { useCustomer } from 'hooks/query'; const ContactDetailDrawerContext = React.createContext(); /** * Contact detail provider. */ function CustomerDetailsDrawerProvider({ customerId, ...props }) { // Handle fetch customer details. const { data: customer, isLoading: isCustomerLoading } = useCustomer( customerId, { enabled: !!customerId, }, ); // Provider. const provider = { customer, customerId, isCustomerLoading, }; return ( ); } const useCustomerDetailsDrawerContext = () => React.useContext(ContactDetailDrawerContext); export { CustomerDetailsDrawerProvider, useCustomerDetailsDrawerContext };