mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
Merge branch 'feature/manual-journals' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, {useMemo} from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import React, {useMemo, useCallback} from 'react';
|
||||
import { useParams, useHistory } from 'react-router-dom';
|
||||
import { useAsync } from 'react-use';
|
||||
import MakeJournalEntriesForm from './MakeJournalEntriesForm';
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
@@ -13,6 +13,7 @@ function MakeJournalEntriesPage({
|
||||
getManualJournal,
|
||||
fetchAccounts,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const { id } = useParams();
|
||||
|
||||
const fetchJournal = useAsync(() => {
|
||||
@@ -25,9 +26,21 @@ function MakeJournalEntriesPage({
|
||||
getManualJournal(id) || null,
|
||||
[getManualJournal, id]);
|
||||
|
||||
const handleFormSubmit = useCallback((payload) => {
|
||||
payload.redirect &&
|
||||
history.push('/dashboard/accounting/manual-journals');
|
||||
}, [history]);
|
||||
|
||||
const handleCancel = useCallback(() => {
|
||||
history.push('/dashboard/accounting/manual-journals');
|
||||
}, [history]);
|
||||
|
||||
return (
|
||||
<LoadingIndicator loading={fetchJournal.loading} mount={false}>
|
||||
<MakeJournalEntriesForm editJournal={editJournal} />
|
||||
<MakeJournalEntriesForm
|
||||
onFormSubmit={handleFormSubmit}
|
||||
editJournal={editJournal}
|
||||
onCancelForm={handleCancel} />
|
||||
</LoadingIndicator>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user