mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
feat: controlled transactions locking type.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import { useTransactionsLocking } from 'hooks/query';
|
||||
import { useWatchImmediate } from '../../hooks/utils/useWatch';
|
||||
|
||||
const TransactionsLockingContext = React.createContext();
|
||||
|
||||
@@ -15,9 +16,17 @@ function TransactionsLockingProvider({ ...props }) {
|
||||
isLoading: isTransactionLockingLoading,
|
||||
} = useTransactionsLocking();
|
||||
|
||||
// Transactions locking type.
|
||||
const [transactionLockingType, setTransactionLockingType] =
|
||||
React.useState('partial');
|
||||
|
||||
// Locking type controlled from response.
|
||||
useWatchImmediate(() => {
|
||||
if (transactionsLocking.locking_type) {
|
||||
setTransactionLockingType(transactionsLocking.locking_type);
|
||||
}
|
||||
}, transactionsLocking.locking_type);
|
||||
|
||||
// Provider
|
||||
const provider = {
|
||||
transactionsLocking,
|
||||
|
||||
Reference in New Issue
Block a user