mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-24 00:29:49 +00:00
feat(webapp): wip tax rates management
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// @ts-nocheck
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { DrawerLoading } from '@/components';
|
||||
import { useTaxRate } from '@/hooks/query/taxRates';
|
||||
|
||||
const TaxRateDetailsContext = createContext();
|
||||
|
||||
interface TaxRateDetailsContentBootProps {
|
||||
taxRateId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax rate details content boot.
|
||||
* @returns {JSX}
|
||||
*/
|
||||
export function TaxRateDetailsContentBoot({
|
||||
taxRateId,
|
||||
...props
|
||||
}: TaxRateDetailsContentBootProps) {
|
||||
const {
|
||||
data: taxRate,
|
||||
isFetching: isTaxRateFetching,
|
||||
isLoading: isTaxRateLoading,
|
||||
} = useTaxRate(taxRateId, { keepPreviousData: true });
|
||||
|
||||
const provider = {
|
||||
isTaxRateLoading,
|
||||
isTaxRateFetching,
|
||||
taxRate,
|
||||
taxRateId,
|
||||
};
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isTaxRateLoading}>
|
||||
<TaxRateDetailsContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
}
|
||||
|
||||
export const useTaxRateDetailsContext = () => useContext(TaxRateDetailsContext);
|
||||
Reference in New Issue
Block a user