feat(account): add currency select.

This commit is contained in:
elforjani13
2022-02-27 14:10:22 +02:00
parent deddbea752
commit a3c79d98b0
4 changed files with 38 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import { DialogContent } from 'components';
import {
useCreateAccount,
useAccountsTypes,
useCurrencies,
useAccount,
useAccounts,
useEditAccount,
@@ -30,16 +31,17 @@ function AccountDialogProvider({
const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
// Fetches accounts types.
const {
data: accountsTypes,
isLoading: isAccountsTypesLoading,
} = useAccountsTypes();
const { data: accountsTypes, isLoading: isAccountsTypesLoading } =
useAccountsTypes();
// Fetches the specific account details.
const { data: account, isLoading: isAccountLoading } = useAccount(accountId, {
enabled: !!accountId,
});
// Handle fetch Currencies data table
const { data: currencies, isLoading: isCurrenciesLoading } = useCurrencies();
const isNewMode = !accountId;
// Provider payload.
@@ -49,6 +51,7 @@ function AccountDialogProvider({
parentAccountId,
action,
accountType,
currencies,
createAccountMutate,
editAccountMutate,
@@ -57,11 +60,15 @@ function AccountDialogProvider({
account,
isAccountsLoading,
isNewMode
isCurrenciesLoading,
isNewMode,
};
const isLoading =
isAccountsLoading || isAccountsTypesLoading || isAccountLoading;
isAccountsLoading ||
isAccountsTypesLoading ||
isAccountLoading ||
isCurrenciesLoading;
return (
<DialogContent isLoading={isLoading}>