diff --git a/frontend/src/components/AddAccountDialog.js b/frontend/src/components/AddAccountDialog.js index 9ab9690..714bc78 100644 --- a/frontend/src/components/AddAccountDialog.js +++ b/frontend/src/components/AddAccountDialog.js @@ -9,6 +9,7 @@ import { createAccount } from '../redux/slices/Accounts'; import { useSelector, useDispatch } from 'react-redux' import MenuItem from '@mui/material/MenuItem'; import { fetchCategories } from '../redux/slices/Categories'; +import { refreshBudget } from '../redux/slices/Budgets'; const accountTypes = ['Bank', 'Credit Card']; @@ -31,13 +32,14 @@ export default function AddAccountDialog(props) { const budgetId = useSelector(state => state.budgets.activeBudget.id) const handleCreateAccount = async () => { - console.log('here') await dispatch(createAccount({ name, accountType, balance, })) + dispatch(refreshBudget()) + // If adding a credit card, update all categories since we have added a payment category for it if (accountType === accountTypes[1]) { dispatch(fetchCategories()) diff --git a/frontend/src/pages/Account.js b/frontend/src/pages/Account.js index 6878ab9..d9fe610 100644 --- a/frontend/src/pages/Account.js +++ b/frontend/src/pages/Account.js @@ -182,7 +182,7 @@ export default function Account(props) { memo: newRow.memo, payeeId: newRow.payeeId, categoryId: newRow.categoryId, - status: 0, // @TODO: implement transaction status + status: 0, } })) @@ -252,6 +252,7 @@ export default function Account(props) { await dispatch(fetchBudgetMonth({ month: formatMonthFromDateString(transaction.date) })) dispatch(fetchCategoryMonths({ categoryId: transaction.categoryId })) dispatch(fetchAccounts()) + dispatch(refreshBudget()) } return (